top of page
OmniStudioFactBg.png
Writer's pictureGayathiri Mohan

Launch an Omniscript from another Omniscript

Updated: Jan 9

There are two ways to launch an Omniscript from another Omniscript.

  1. Embedding a Reusable Omniscript

  2. Using Navigate action


Let us understand these two approaches with the help of examples.


Method 1: Embedding a Reusable Omniscript

To create a ‘Reusable’ Omniscript, 

  1. Go to the ‘Setup’ tab of the Omniscript

  2. Check the ‘Reusable’ checkbox. 

This allows the Omniscript to be embedded inside another Omniscript.

This is useful when we have a generic component (say, ‘Address’ section) that has to be reused across multiple Omniscripts.


In the below example, a ‘Reusable’ Omniscript is created as shown in the below image and activated.

Inside the step, there is a formula field that calculates the ‘Age’ dynamically based on the date of birth (‘%UserDOB%’) value.

Also, a Text Block with dynamic variables (%ContextId%, %UserName%, %FormulaAge%) is added.

Now another Omniscript has been created, and two input elements are added inside the step as shown below.



Now in the ‘Omniscripts’ section of the ‘Build’ tab, the reusable Omniscript will appear.

Drag and drop it below the step in the parent (‘embedding’) Omniscript.

The child (embedded) Omniscript can now access the nodes from the Data JSON of the parent Omniscript.


Output:

Now in the ‘Preview’ mode, the ‘Context ID’, ‘Name’, and ‘Date of birth’ values are entered.

On clicking ‘Next’, the child (embedded) Omniscript is getting launched.

And it displays the ‘Context ID’, ‘Name’ and calculated ‘Age’ (from ‘Date of birth’) values by accessing the data entered in the parent Omniscript’s step from the Data JSON.


NOTE:

A reusable Omniscript, 

  • cannot be embedded inside another ‘Reusable’ Omniscript.

  • can be added to a parent (‘embedding’) Omniscript only once.

  • can be placed anywhere between different steps or before and after any step in an embedding Omniscript, but not inside any Step element.


Method 2: Using Navigate action

Now let us see how to launch an Omniscript from another Omniscript via the ‘Navigate Action’.

Drag and drop the ‘Navigate Action’ inside a step and fill in the properties as needed.


Navigate Action Properties:


Name - enter a unique name for the Navigate Action. In this example,  ‘NavigateToChildOS’ is the ‘Name’.


Field Label - enter any label based on the need. Here, ‘View Data’ is the ‘Label’.


Button Variant - ‘brand’ by default, can be modified if required.


Icon Name - we can enter any icon name optionally. Here, ‘action:preview’ is the ‘Icon Name’.


Icon Position - ‘Left’ by default. It can be modified to ‘Right’ if the icon needs to be positioned ‘right’.


Page Reference Type - select ‘Vlocity Omniscript’ to redirect to another Omniscript when the ‘Navigate Action’ is clicked.


Replace - when ‘checked’, the existing entry in the browser history is replaced, and so the user cannot navigate back to the parent OmniScript from where the ‘Navigate Action’ was clicked.


LWC Omniscript - enter the name of the target Omniscript (to be redirected to) in the format-‘c:typeSubTypeLanguage’.

In our example, the Omniscript name is ‘c:taskChildOSPOCEnglish’ where,

type : ‘task’,

SubType : ‘ChildOSPOC’ and

Language : 'English'


Omniscript Layout - ‘Lightning’ by default for ‘LWC’. It specifies the layout for rendering the Omniscript.


Omniscript Prefill - optionally pass any values to the new Omniscript as URL parameters. The parameters should be appended with the prefix ‘c_’. It supports both static and dynamic values. For Dynamic values, use the ‘Merge Fields’ syntax. To pass multiple values in the URL parameters, we have to use the ‘&&’ operator.

In our example, the below value is entered.

c__ContextId=%ContextId%&&c__UserName=%UserName%&&c__UserDOB=%UserDOB%

Where ‘c__ContextId’, ‘c__UserName’ and ‘c__UserDOB’ are the URL parameters.

And ‘%ContextId%’, ‘%UserName%’ and ‘%UserDOB%’ are the dynamic values (using ‘Merge Fields’ syntax) to be passed to the Omniscript.


Validation Required - ‘None’ by default. If needed, it can be modified to ‘Step’ to perform any step validations when the Navigate Action is clicked.


Output:

Now the Omniscript is activated and added to a record page to see how it behaves (since ‘Navigate Action’ doesn’t run in preview mode).

The appropriate data is entered, and the Navigate Action ‘View Data’ is clicked.

Now, it can be observed that the new Omniscript is launched, and it displays dynamic content based on the data passed via the URL parameters.


NOTE: 

  • Alternatively, the ‘Navigate Action’ can also be placed outside a step to redirect to another Omniscript by setting the same properties. 

  • Unlike the previous method (embedding a reusable Omniscript), the new Omniscript launched via the ‘Navigate Action’ will not have a ‘Previous’ button in the step to go back to the parent Omniscript step from where it was launched. It behaves like an entirely new Omniscript.


References:



2,041 views0 comments

Recent Posts

See All
OmniStudioFactFooterBg.png
logo.png

OmniStudiofacts helps us to build a Vlocity/OmniStudio Tech Community which focuses on sharing technical skills and experience across the globe.

© 2023 by OmniStudioFacts.

bottom of page