function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JESJES 

Embedding custom object field values (merge fields) in SFDC email template

I have created a custom object called Quote (related to an Opportunity) that captures all information necessary to request a quote from another department that is not using SFDC.  I would like to be able to send the details of a Quote record in an email to this other department and log it as an activity.  Since I cannot add "Send Email" Activity related list to this custom object, I was hoping to create a web link to the SFDC email page referencing the Quote object from which the link was clicked.  Then I wanted to use merge fields in an email template to "fill in" all the variable data associated with that Quote object. 

I can create the pop-up window to the email page, but merge fields fail to recognize the object I wish to pull data from.  Is what I'm trying to do possible?  If not, is there another workaround that allows me to send data from a record without having to create an sforce object that would use the WSDL to access the information in a separate process?

DevAngelDevAngel

Hi JES,

In playing around with this a little bit, you can use a url like the following

https://na1.salesforce.com/email/author/emailauthor.jsp?retURL=%2F00630000000h8dc&what_id=00630000000h8dc&template_id=00X30000000bwcf&new_template=1&p2=Dave%20Carroll&p4=dcarroll@merce.com

I'll disassemble this.

https://na1.salesforce.com/email/author/emailauthor.jsp is the link to the email authoring page.

?retURL=%2F00630000000h8dc&what_id=00630000000h8dc is the return url back to the opportunity detail.  The ID of the oppty that I linked from is 00630000000h8dc and is shown twice in the return url.  Up to this point, this is the url that is in the address bar if you just click Email from an opportunity page.

&template_id=00X30000000bwcf is the id of an email template that is set up with merge fields.  This will pre-compose the body of the message and I think is one of the pieces you are looking for.

&new_template=1 tells the page to load the template specified above.

&p2=Dave%20Carroll will be used to specify the recipient.  The name entered here must be the name of a contact or lead in the system.  When the page loads a search is performed to try to locate the correct person record.

&p4=dcarroll@merce.com is how you would set the bcc field.

I obtained these values and parameter names by inspecting the source of the email template page and just tried adding them to the url as parameters.

This is not a supported method, but worth looking at.  The risk is that if we change any of the field names on the form, then the url will stop working.

 

JESJES

Dave,

Thanks for looking into this.  i was able to get this far. however, my issue seems to be referencing the custom object (in this case Quote, for which there can be many to a single Opportunity) such that i could merge fields from that object into the email template.  I put the Quote object ID into the URL and the message was that i had performed some action that was not allowed or for which i didn't have sufficient permission.  Does the "what_id" have to equal the id of a standard object? or can it reference a custom object?

thanks again,

Jan

pmozzpmozz
I, too, am having the same difficulty.  Was there a response to the previous post somewhere else? Thanks!