• ReneeL
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies

Hello,

 

I'm having an issue with sending an email.  I'm using the following code and the email is indeed getting sent if I don't include the WhatIds but it is not getting the merge fields populated.  If I include the WhatIds then I get an error message - "{faultcode:'soapenv:Client', faultstring:'Element {urn:partner.soap.sforce.com}WhatIds invalid at this location', }:result ="

I'm looking to send an internal email based on data in a Contract.  I have created an email template using the merge fields from the contract object.  I did read that the WhatIds only work on emails being sent to Contacts but all of our internal people are Contacts also so this doesn't pose a problem.

 

Any help would be greatly appreciated.

 

 

<html>
   <head>
   <script src="/soap/ajax/10.0/connection.js" type="text/javascript"></script>
   <script>
      alert("Starting script");
      var contactId = "{!Contact.Id}";
      var contractId = "{!Contract.Id}";
      alert("ContactId: " + contactId);
      alert("ContractId: " + contractId);
      function sendEmail() {
            alert("Starting sendEmail function");
            var result = "";
            try {
                     alert("Starting Try");  

                        var mass = new sforce.MassEmailMessage();
           
                        mass.replyTo = "rleblanc@syberworks.com";
                        alert("mass.replyTo: " + mass.replyTo);
                        mass.subject = "Mass Email from SF!";
                        alert("mass.subject: " + mass.subject);
                        var a = new Array(1);
                        a[0] = contactId;
                        alert("Contact ID - a[0]: " + a[0]);
                        mass.targetObjectIds = "0035000000ZxRr7";
                        alert("Mass targetObjectIds: " + mass.targetObjectIds);
                         mass.saveAsActivity = false;
                        mass.WhatIds = contractId;
                        alert("mass.WhatIds: " + mass.WhatIds);
                         mass.templateId = "00X50000000xsVKEAY";
                         alert("Mass.templateId: " + mass.templateId);
                        var sendMailRes = sforce.connection.sendEmail([mass]);
                     output.innerHTML = "Email sent! " + "result: " + result;
            } catch(error) {
                        output.innerHTML =  error + ":result = " + result;
            }
      }
   </script>
   <body onload="sendEmail()">
      <div id="output"></div>
   </body>
</html>

 

I got this code from a previous post and modified it some but if I can get it to work will likely continue to modify it.

 

Thanks!

Renee

Hello,
 
I've created an s-control and in it is a very plain web page (at least currently) and some text.  Below that is a link that users can click on and it should bring them to another page and supply some login info for them.  It seemed to be working and I tweaked it a little bit and now it is appending additional info to the link  - the following info
 
https://na3.salesforce.com/servlet/servlet and then my link but encased in quotes.  The site that I'm directing the users to is completely outside of salesforce and according to the help which uses a google link this shouldn't be a problem.  Why am I being redirected inside of Salesforce?  Any help is much appreciated!
 
The other issue I seem to be running into is that when it does appear to partially work the pieces of the link don't seem to getting passed through.  I've tested the link in a stand alone page from my desktop and it works fine from there so the code itself is good but is there something else I should be doing?  Or a way around using s-controls that might make this easier?
 
Thanks!
 


Message Edited by ReneeL on 10-24-2008 07:51 AM
  • October 24, 2008
  • Like
  • 0
Hello,
 
I am struggling with an issue that I hope someone can help me with.  I'm assuming this must have been done before and hope I'm not reinventing the wheel.
 
My company has a webpage that collects lead information from people that want to get a free trial of our software.  We need this info to be entered into Salesforce.com as a lead.  I know that Salesforce.com has a web to lead piece but we need the users to enter the info on the page that already exists as it is doing many other things in the background.  I have been poking around in the help files but I'm not familiar enough with Salesforce.com to determine what is the best way to do this. 
 
Any help would be appreciated!!
 
Thanks!
Renee
  • October 16, 2008
  • Like
  • 0

I frequently have duplicate records when importing contacts into salesforce, and therefore, some of the contact information gets lost during the import. I know salesforce does not overwrite fields that are filled on already existing contacts, but is there a way to add information onto the end of an existing field?

 

We keep track of each contact's source, and if a contact shows up in more than one source I am looking for a way to see that. 

 

Any suggestions?

Hello,

 

I'm having an issue with sending an email.  I'm using the following code and the email is indeed getting sent if I don't include the WhatIds but it is not getting the merge fields populated.  If I include the WhatIds then I get an error message - "{faultcode:'soapenv:Client', faultstring:'Element {urn:partner.soap.sforce.com}WhatIds invalid at this location', }:result ="

I'm looking to send an internal email based on data in a Contract.  I have created an email template using the merge fields from the contract object.  I did read that the WhatIds only work on emails being sent to Contacts but all of our internal people are Contacts also so this doesn't pose a problem.

 

Any help would be greatly appreciated.

 

 

<html>
   <head>
   <script src="/soap/ajax/10.0/connection.js" type="text/javascript"></script>
   <script>
      alert("Starting script");
      var contactId = "{!Contact.Id}";
      var contractId = "{!Contract.Id}";
      alert("ContactId: " + contactId);
      alert("ContractId: " + contractId);
      function sendEmail() {
            alert("Starting sendEmail function");
            var result = "";
            try {
                     alert("Starting Try");  

                        var mass = new sforce.MassEmailMessage();
           
                        mass.replyTo = "rleblanc@syberworks.com";
                        alert("mass.replyTo: " + mass.replyTo);
                        mass.subject = "Mass Email from SF!";
                        alert("mass.subject: " + mass.subject);
                        var a = new Array(1);
                        a[0] = contactId;
                        alert("Contact ID - a[0]: " + a[0]);
                        mass.targetObjectIds = "0035000000ZxRr7";
                        alert("Mass targetObjectIds: " + mass.targetObjectIds);
                         mass.saveAsActivity = false;
                        mass.WhatIds = contractId;
                        alert("mass.WhatIds: " + mass.WhatIds);
                         mass.templateId = "00X50000000xsVKEAY";
                         alert("Mass.templateId: " + mass.templateId);
                        var sendMailRes = sforce.connection.sendEmail([mass]);
                     output.innerHTML = "Email sent! " + "result: " + result;
            } catch(error) {
                        output.innerHTML =  error + ":result = " + result;
            }
      }
   </script>
   <body onload="sendEmail()">
      <div id="output"></div>
   </body>
</html>

 

I got this code from a previous post and modified it some but if I can get it to work will likely continue to modify it.

 

Thanks!

Renee

Hello,
 
I've created an s-control and in it is a very plain web page (at least currently) and some text.  Below that is a link that users can click on and it should bring them to another page and supply some login info for them.  It seemed to be working and I tweaked it a little bit and now it is appending additional info to the link  - the following info
 
https://na3.salesforce.com/servlet/servlet and then my link but encased in quotes.  The site that I'm directing the users to is completely outside of salesforce and according to the help which uses a google link this shouldn't be a problem.  Why am I being redirected inside of Salesforce?  Any help is much appreciated!
 
The other issue I seem to be running into is that when it does appear to partially work the pieces of the link don't seem to getting passed through.  I've tested the link in a stand alone page from my desktop and it works fine from there so the code itself is good but is there something else I should be doing?  Or a way around using s-controls that might make this easier?
 
Thanks!
 


Message Edited by ReneeL on 10-24-2008 07:51 AM
  • October 24, 2008
  • Like
  • 0
Hello,
 
I am struggling with an issue that I hope someone can help me with.  I'm assuming this must have been done before and hope I'm not reinventing the wheel.
 
My company has a webpage that collects lead information from people that want to get a free trial of our software.  We need this info to be entered into Salesforce.com as a lead.  I know that Salesforce.com has a web to lead piece but we need the users to enter the info on the page that already exists as it is doing many other things in the background.  I have been poking around in the help files but I'm not familiar enough with Salesforce.com to determine what is the best way to do this. 
 
Any help would be appreciated!!
 
Thanks!
Renee
  • October 16, 2008
  • Like
  • 0