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
alonmalonm 

template of emailFields in publisher.setActionInputValues

In order to send an email with a predefined email template (from the case feed email action), I am using this code (based on the example in p.29 in https://resources.docs.salesforce.com/sfdc/pdf/case_feed_dev_guide.pdf):
function emailSolution(content) {   
    Sfdc.canvas.publisher.publish({name: 'publisher.selectAction', 
    payload: { actionName: 'Case.Email'}}); 
    Sfdc.canvas.publisher.publish({name: 'publisher.setActionInputValues', 
    payload: {
       actionName: 'Case.Email',
       emailFields: {
            template: 'folderName/templateName', 
            body: { value:content, format:'richtext', insert: true}
       }
}});

However, the template parameter has no effect on the email (the email body contains only the string 'content'). If the body parameter is omitted, the email body is empty. I couldn't find any example for usage of the template parameter in the online documentation, has anyone tried already to use it and can provide a code sample?
Hendrik AdamHendrik Adam
Here is the right code with template parameter:
function emailSolution(content) {   
    Sfdc.canvas.publisher.publish({name: 'publisher.selectAction', 
    payload: { actionName: 'Case.Email'}}); 
    Sfdc.canvas.publisher.publish({name: 'publisher.setActionInputValues', 
    payload: {
       actionName: 'Case.Email',
       emailFields: {
            template: {id:'<TEMPLATE ID>'}, 
            body: { value:content, format:'richtext', insert: true}
       }
}});
It is recommended to use the new generic quick action payload format:
{name:"publisher.setActionInputValues",payload:{actionName:"Case.Email", targetFields: {ToAddress:{value:"customer@company.com"},Subject:{value:"Your Issue Has Been Resolved"},TextBody:{value:"test body"}}}}
... and with template parameter:
{name:"publisher.setActionInputValues",payload:{actionName:"Case.Email", emailTemplate:{id:"00Xxx000000giDx"}}}

 
Anshul Agrawal 27Anshul Agrawal 27
Hi, I am not able to send the email on Case.Email using template Id.

Sfdc.canvas.publisher.publish({name: 'publisher.selectAction', 
            payload: { actionName: 'Case.Email'}}); 
            Sfdc.canvas.publisher.publish({name: 'publisher.setActionInputValues', 
            payload: {
                   actionName: 'Case.Email',
                   emailFields: {
                    template: {id: id}, 
                }
                   //emailTemplate:{id:id}
            }});

User-added image

https://developer.salesforce.com/docs/atlas.en-us.case_feed_dev.meta/case_feed_dev/case_feed_dev_guide_component_interactions.htm
Anshul Agrawal 27Anshul Agrawal 27
We got it working with 15 digit ID