+ Start a Discussion
SapamrmSapamrm 

Custom "send email"-button with record creator as default recipient

I've created a custom object "Commercial Agreements".

When creating a new email from the Activity History related list "send email"-button, I would like the recipient ("To") to have a default value, the (commercial agreement) record creator.

 

 

 

Code of the standard "send email"-button is:

https://na1.salesforce.com/_ui/core/email/author/EmailAuthor?p2_lkid=0013000000dLWUx&rtype=003&p3_lkid=a063000000CJweX&retURL=%2Fa063000000CJweX

 

with 0013000000dLWUx = Account ID

and a063000000CJweX = Commercial agreement record ID

 

 

How should I adapt the code for my custom button so that the record creator is automatically filled in in the "To"-field?

What is the code/ID for that "To"-field?

 

 

Thanks in advance!

VK86VK86

hi Sapamrm,

 

Please refer to this thread HERE 

You can select a default template too and add additional receipients.

 

This is a work around but should be helpful.

 

--VK

Ritesh AswaneyRitesh Aswaney

Think its p2_lkid that you're looking for. Set that to the Salesforce Id of the Recipient.

 

I've found this Web Developer add-in for firefox very handy to be able to pull out html ids of elements for this type of operation.

http://chrispederick.com/work/web-developer/

 

After installing this, you will see a toolbar display in firefox. Hit Forms -> Display Form Details, and lo voila, you can quickly copy any id's you may need.

SapamrmSapamrm

Hi!

 

Thx for the replies!

 

I tried adding the following to the button code: &p2_lkid={!Commercial_Agreement__c.CreatedById}, but this did not work.

 

Even when I tried with a direct contact ID: &p2_lkid="0033000000hHHHS"  the contact name was not filled in in the "To"-field..

VK86VK86

hi,

 

i think u are using the Standard field 'Created By'

try using a custom field and it should work.

 

--VK

SapamrmSapamrm

It can't be p2_lkid.

 

I just noticed that this field is already used to to pass the account ID.

 

Code I have so far:

 

https://na1.salesforce.com/_ui/core/email/author/EmailAuthor?p2_lkid={!Account.Id}&rtype=003&p3_lkid={!Commercial_Agreement__c.Id}&retURL=%2F{!Commercial_Agreement__c.Id}&p6="{!Commercial_Agreement__c.Name}: {!Commercial_Agreement__c.Account__c} {!Commercial_Agreement__c.Amount__c}"

 

VK86VK86

Hi Sapamrm,

 

Please try this code exactly as it is changing the custom email fields and template id.

 

location.replace('_ui/core/email/author/EmailAutho​r?p2_lkid={!Commercial_Agreement__c.My_Cutom_To_EmailField__c}&rtyp​e=003&p3_lkid={!Commercial_Agreement__c.Id}
&rtype=003&p24={!Commercial_Agreement__c.My_Custom_AdditionalToEmail__c}&retURL=/{!Commercial_Agreement__c.I​d}&template_id=00XA0000000​Dv41')

 

 

 

-- VK