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
Tommy GeorgiouTommy Georgiou 

Button for email template and recipient

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 
 
location.replace('/email/author/emailauthor.jsp?retURL=/{!Order.Id}&p3_lkid={!Order.Id}&rtype=003&p3_lkid={!Order.OrderNumber}&p3_1kid={!$User.Email}&p24="xxxxx@spidernet.com&template_id=00Xw0000001U7YN');


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

User-added image

`
Best Answer chosen by Tommy Georgiou
Tommy GeorgiouTommy Georgiou
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