I have a custom field called Contact__c in my Opportunity object. It is a lookup to the Contact object. I created a custom button to send email so I could edit the URL to fill in the TO: field with Contact__c. The custom button has the following in it:
/_ui/core/email/author/EmailAuthor?p2_lkid={!Opportunity.Contact__c}&rtype=003&%2F0064000000cBDQe
This is not working because it's putting the the name in the url instead of the Contact Id. Example:
https://na2.salesforce.com/_ui/core/email/author/EmailAuthor?p2_lkid=Randy+Riegel&rtype=003&%2F0064000000cBDQe
If I edit the URL manually in my browser and change "Randy+Riegel" to the ID of that contact the field populates fine when refreshed. How can I get the ID in the URL instead of the Name?
{!Opportunity.Contact__r.Id}
?{!Opportunity.Contact__r.Id}
does not exist.ContactId__c
that is defined asContact__r.id
. Then reference {!ContactId__c} in the URL constructionOpportunityContactRole
sobject? and you want to send an email to the primary OCR?