I have created a custom button(like send an email function) to define the email template and the recipient email address. Behavior is set to execute Java, content source is OnClick Java. Code is `


My problem is that it defines the additional to field and not the To. See image below. Any ideas why?

enter image description here


1 Answer 1


After digging a bit more. For the reference of others the solution is:

  1. Create a custom field button that the takes the contact's ID from the account
  2. Then a lookup field on the Orders for the contacts
  3. Then create a custom button as a detail page button, executing Java.

The code for the button is :

location.replace('/email/author/emailauthor.jsp?retURL=/{!Order.Id}&p3_lkid={!Order.Id}&rtype=003&p3_lkid={!Order.OrderNumber}&p3_1kid={!$User.Email}&p2_lkid={! Order.Supplier_s_ContactId__c }&template_id=00Xw0000001UHlg');

where Supplier_s_ContactId__c is the custom field that you create on the first step. Works like a charm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.