+ Start a Discussion

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:



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!


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.



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.



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.




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..




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

try using a custom field and it should work.




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}"



Hi Sapamrm,


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






-- VK