---
schema_version: "1"
id: 85c476404f670745a15dc6bca1bf30d3a3b48ea8dba95bb9f123ab03376b341e
title: Emailing an Omniscript (Managed Package)
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/os_emailing_an_omniscript.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.os_emailing_an_omniscript.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: ec754dfc371208cb3f9b4ddf6292e846830d5b900a504cd5a5e522c6a285054c
description: For the managed package runtime, 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.
products:
  - Omnistudio
release: "264"
---
# Emailing an Omniscript (Managed Package)

For the managed package runtime, 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.

![Managed Package app icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/resources-global/_corporate/images/managedpackageicon.png) This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see [Omnistudio Help](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_standard.htm&language=en_US).

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 implement this feature, you create the following components:

- An email template containing 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 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](https://help.salesforce.com/articleView?id=faq_getstart_what_languages_does.htm&type=5&language=en_US) .
- **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.

## Specifying the Integration Procedure Action

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.

- **[Create the Email Template With the Omniscript Link (Managed Package)](https://help.salesforce.com/s/articleView?id=xcloud.os_creating_the_email_template.htm&release=264.0.0&type=5)**  
    For the managed package runtime, 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)**.