You are here:
Emailing an Omniscript
To email a link to an Omniscript to a Contact, Lead, or User, you create an Integration Procedure that uses a remote action to send the email and call the Integration Procedure from an Omniscript or from Apex code.
For example, an insurance agent who requires details about a prospect can email an Omniscript link to the prospect. When the recipient of the email clicks the link, their browser displays the Omniscript, containing whatever data the sender has entered. The recipient fills in the required information, enabling the agent to create a quote for them.
The recipient does not need to have a Salesforce account to access the Omniscript but must have a Contact, Lead, or User record containing their email address and the permissions required to view the script. The recipient might be required to log in to view the email.
To email an Omniscript, create these tasks:
-
An email template with the required merge fields
-
An Integration Procedure containing a remote action that invokes the email-sending method, passing in the required parameters
-
In the Omniscript, an Integration Procedure action that calls the email Integration Procedure
The following sections provide details about creating the required components.
Creating the Email Template With the Omniscript Link
Define an email template containing the desired text, which includes a link to the Omniscript. The email template type must be Custom (without using Letterhead).
Before you create the email template, determine the link of the Omniscript to email. See the URL examples in How to Launch Omniscripts.
After giving the new template a name and subject, enter the text of the email in
HTML Value and include the Omniscript link. Use Salesforce-style
variables (formatted as {!object.field}) to incorporate Salesforce data,
and Omnistudio-style merge fields (formatted as %fieldname%) to incorporate
data provided by the Integration Procedure with the Email action.
Example of an email body with variables for the recepient's name and a merge field for the sender's name.
Hi, {!Contact.Name}:
Here's a link to the OmniScript you requested:
https://MyDomainName.lightning.force.com/lightning/page/omnistudio/omniscript?omniscript__type=%Type%&omniscript__subType=%Subtype%&omniscript__language=English&omniscript__theme=lightning
Thanks,
%SenderName%Creating the Email Integration Procedure
To send the email, create an Integration Procedure containing a remote action with the following settings:
-
Remote Class: DefaultOmniScriptSendEmail
-
Remote Method: emailOmniScriptLink
In the Remote Options section, define the following required key/value pairs, plus any merge fields required by the email template:
-
Language : Omniscript language. For multi-language Omniscripts, set to "Multi-Language" and set the LanguageCode parameter to the Salesforce language code .
-
Type : Omniscript type.
-
Subtype: Omniscript subtype.
-
emailTargetObjectId: The Id of the recipient (contact, lead, or user).
-
emailTemplateName : The Salesforce Unique Template Name.
-
saveAsActivity: Set to true if you want an activity record created when the email is sent.
-
LanguageCode : For multi-language Omniscripts, the Salesforce language code.
This remote action creates an Omniscript record with the specified Type, Subtype and Language. Before the Omniscript is saved, all actions prior to the first step are run, which enables you to prefill information about the Contact, Lead, or User. The Remote Action merges the data into the email template and sends the email.
To test the Integration Procedure, go to the Preview tab and define an input parameter named "contextId" that contains the Id of a valid Contact, Lead, or User who has a valid email address. When you are satisfied that the Integration Procedure works as desired, activate it.
Calling the Email Integration Procedure
In the Omniscript, at the point where you want the email sent, add an Integration Procedure action with the following settings:
-
Integration Procedure Key: Email_Action
-
Extra Payload:
-
Key: contextId
-
Value: the Id of the Contact to whom you want to send the email.
-
The Omniscript must provide the contact Id in the contextId node of the JSON payload that is sent to the Integration Procedure.
To verify that you have configured all settings correctly, preview the Omniscript and check the resulting email.

