Results 1 to 2 of 2

Thread: javascript referencing extrenal database

  1. #1
    Join Date
    Oct 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default javascript referencing extrenal database

    I am having some difficulty with this script.
    It was sent to me by a colleague to modify. There may be some redundant code there, as I only need a small part of what it originally did and have removed what I considered to be irrelevant.

    I think I am close - but I keep getting a syntax error.

    The DB is a Salesforce.com account.

    Any help would be greatly appreciated!!!

    Code:
    {!REQUIRESCRIPT("/soap/ajax/9.0/connection.js")}
    
    var records = {!GETRECORDIDS($ObjectType.Participants__c)};
    
    if (records[0] == null) {
     alert("Please select at least one attendee to email.");
    }
    else {
     for (  var contactQR = sforce.connection.query("SELECT Participant FROM Participant__c Where Id = '" + contactName+ "'");
      var contactName = contactQR.getArray('records')[0].Participant__c;
    
      //Bind and send email
      var singleEmailRequest = new sforce.SingleEmailMessage(); 
    
      singleEmailRequest.charset = "UTF8";
      singleEmailRequest.subject = "";
      singleEmailRequest.saveAsActivity = true;       
      singleEmailRequest.targetObjectId = participant__c;
    	     
      singleEmailRequest.htmlBody = "<font face=arial size=2><img src='https://emea.salesforce.com/servlet/servlet.FileDownload?file=015200000008PB3' border='0'>" +
      
      //singleEmailRequest.plainTextBody = "Plain text body";	        
      sendEmailResults = sforce.connection.sendEmail([singleEmailRequest]);
     }
    
     alert("Your emails has been successfully sent to selected attendees.");
    }
    Edit: Replaced blinding [icode] with [code]
    Last edited by tech_support; 11-30-2007 at 06:05 AM.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    By the way, you should probably use [code] for long blocks of code. [icode] is better for shorter blocks.


    Honestly, I don't recognize that style of Javascript. Javascript cannot connect to a database, though some variation may be able to. Is this ActiveX, and therefore reliant upon Internet Explorer?

    I assume someone will be able to help more.

    This looks like some odd mix of Javascript and ASP, to me.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •