This article outlines the process to allow a decision tree integrated with a Salesforce record to use your Salesforce Email Templates. These emails are sent via Salesforce rather than a Zingtree email node.
The user can click a button within the tree that will display the available email templates. Once a template is chosen, the user can choose the From Email Address and process the email.
Requirements
- Zingtree embedded in a Salesforce Case record. Please see this article to set up the Zingtree integration in your Salesforce environment. The case will need the Contact's Email address already saved in order for the templates to send.
- Email-to-case set up in your Salesforce environment.
- An Email Template folder in Salesforce that contains the templates you would like this tree to use. The folder and templates can be created in either Classic or Lightning. In either case, we will need the API name of the folder. This is also known as the Folder Unique Name.
Setup Salesforce Email Templates for use with Zingtree
- Create an email template folder that contains all of the templates that you would like Zingtree to choose from. You can create the folder in either Classic or Lightning.
- Make note of the API name or Folder Unique Name. If you created the folder in Lightening, you'll need the Folder Unique Name. If you created the folder in Lightening, you'll need the folder API name.
Setup your Tree
- In the Zingtree editor, open the tree that you want to display your Salesforce Email Templates.
- Navigate to Settings > Code tab.
- Enter the following code, then Save:
<script>
function showEmailTemplates(param) {
window.parent.postMessage('sf_ShowEmailTemplates-'+ param, '*');
}
</script> - In the Zingtree editor, add/edit the Content Node where you would like to have Zingtree choose from your Salesforce Email Templates and send an email.
- Enable Code View in the Content Node Editor by clicking here:
- Paste this code where you would like the button to appear:
<a class="btn btn-primary" onclick="showEmailTemplates('sf_f_EmailTemplatesforZingtree');" style="cursor:pointer;">Choose an email template</a>
- Replace this section of the code with the name of your Email Template Folder as it is named in Salesforce. This must be the folder's API name or Folder Unique Name. This cannot be the main default folder. Create a folder that contains all of the templates that you would like Zingtree to choose from. If you created the folder in Lightening, you'll copy the Folder Unique Name. If you created the folder in Lightening, you'll copy the folder API name.
- Optionally, you can replace the text of "Choose an email template" with the text of your liking. This will be the text that displays on the button.
- Copy your Tree ID so that you can now embed this tree in your Salesforce environment on a Case Object page layout. This step assumes that you've already configured your Zingtree/Salesforce integration.
- Adding Zingtree Session Data to Salesforce Forms
- Salesforce: How to Integrate
- Inserting or Updating Salesforce Objects