Vlocity Facts #08 | How to launch OmniScripts?

After completion of developing omniscript we need to launch omniscripts to provide access to the users.
These are the different ways to launch the omniscript

  1. We can embed the component into any Aura or LWC component. 
  2. By using Action, Menu elements in flex cards we can launch the omniscript from flexcards.
  3. We can launch the omniscript from community page or lightning record page.
  4. By using buttons, links and Actions we can launch launch from object detail page.
  5. We can use custom links or URL's for launching omniscript.
  6. From Flows also we can launch we can launch omniscript.
  7. By using Vlocity actions for launching omniscript. 
Note: We can use Visualforce page also for launching OmniScripts with required styles instead of choosing URL's in Custom Button or Links we can choose Visualforce page.

Now let see how can we use different options to launch.
=========================================================================
Action, Menu elements in flex cards:

Create flex card or using existing one for launching omniscript.
From Build drag and drop Menu Element.
 -> Element Name: Any name
 -> Label: Related to your requriment
 -> Icon : you can use custom or standard icon 
After filling the details now scroll down to last and and click on "Add Action", choose Action Type as omniscript, label name, Icon name according to your requirement and select the Omniscript, Console tab label, Console tab icon with ContextId which need to be launched and displayed.
Same steps need to be followed for Action element also

Create flex card or using existing one for launching omniscript.
From Build drag and drop Action Element.
 -> Element Name: Any name
 -> Label: Related to your requriment
 -> Icon : you can use custom or standard icon 
After filling the details choose Action Type as omniscript, label name, Icon name according to your requirement and select the Omniscript, Console tab label, Console tab icon with ContextId which need to be launched and displayed. 
========================================================================
Community page or lightning record page:
To configure the Vlocity OmniScript component Community Builder:

-> From the Community Builder, drag the Vlocity OmniScript component into your page.
-> When on a Lightning Record Page, the record Id for the object on the page is automatically passed
         into the Record Id field when it contains the {!recordId} parameter.
-> Specify the Type and SubType of your OmniScript with Language.
-> (Optional)- Max Height,  Scroll Offset, Custom Visualforce Page
To configure the Vlocity OmniScript component for Lightning App Builder :

-> From the Lightning App Builder, drag the Vlocity OmniScript component into your page.
-> You can Choose the Layout [ Lightning, Newport].
-> inline - Check box is used for to display the omniscript in a button format.
-> Choose inlineVariant , dir [ltr, rtl] according to your requriment.
========================================================================
Custom List Buttons, Detail page Button or Link: 

To create custom button navigate to object manger from setup and choose the object according to your requirement and follow these steps.

    -> Setup -> Object manger -> Object -> select the buttons, links and actions ->click on "New Button or Link".
   ->  Label, Name, Description [optional], Behavior type, Content source as URL. 
   ->  Display type  
  • Detail Page Link - Use this option to create a link that you can add to the links section of any Account detail page. Links can display other pages or websites.
  • Detail Page Button - Use this option to create a button that you can add to the heading of any Account detail page. Detail page buttons take action on the record that the user is viewing.
  • List Button - Use this option to create a button that you can add to the heading of any Account list view or related list. List buttons allow users to select multiple items in the list and perform an action on all of them at once. To add list buttons to list views, edit the list view layout in search layouts. To add list buttons to related lists, edit the related list properties on the page layout where the Account related list appears.
Now navigate to your omniscript from top right side click on "How to launch omniscript". and copy the lightning url from /lightning to end.
/lightning/cmp/omnistudio__vlocityLWCOmniWrapper?c__target=c:demoWorkEnglish&c__layout=lightning&c__tabIcon=custom:custom18
at the end add id of the object like this &c__ContextId={!Account.Id}
After adding the the url will look like this 
/lightning/cmp/omnistudio__vlocityLWCOmniWrapper?c__target=c:teamEditAccountEnglish&c__layout=lightning&c__tabIcon=custom:custom18&c__ContextId={!Account.Id}

Paste this URL in custom button or link and add that button to the page layout.
=========================================================================
Custom links or URL's:
We can launch omniscripts from URL's also by using the following syntax.

<a href="#/OmniScriptType/AAA1/OmniScriptSubType/AAA2/OmniScriptLang/AAA3/ContextId/[ContextId]/PrefillDataRaptorBundle/[BundleName]/[verticalMode]">Launch OmniScript</a>
  • AAA1—OmniScript Type
  • AAA2—OmniScript Sub Type
  • AAA3—OmniScript Language
  • [ContextId] (Optional)—Context Id for example {!Account.Id}or {!Case.Id}
  • [BundleName] (Optional)—DataRaptor Bundle name used for pre-filling fields into the script. While this functionality is still supported, Vlocity recommends using the Data Raptor Extract Action within OmniScripts to prefill.
  • [VerticalMode] (Optional)—/true or /false. Default is True. If True, all the steps are vertically stacked. If False, all the steps are horizontally navigated.
After providing the required details in above link
          <a   href="#/OmniScriptType/team/OmniScriptSubType/editAccount/OmniScriptLang/English/ContextId/{!Account.Id}/PrefillDataRaptorBundle/false">Launch OmniScript </a>
=========================================================================
Vlocity action:

By using Vlocity action also we can launch the omniscript for that first we need to create Vlocity action. In Vlocity action you need to mention the Vlocity Action Name, Target URL, URL parameter, Display Label, Open URL in, Link Type, Active, Application Type, Application User Profile.

    Vlocity Action Name, Label Name, Open URL in mention and choose according to your requirement, make the Vlocity action active and choose on which object, profile this vlocity action can avaliable.
        URL Parameter: Copy the lightning URL from "How to launch" in omniscript. 
        URL Preview: Id
        Link Type: OmniScript
                        /lightning/cmp/omnistudio__vlocityLWCOmniWrapper?                                     c__target=c:demoWorkEnglish&c__layout=lightning&c__tabIcon=custom:custom18

Now at the end you need to mention &c__ContextId={0}
                                                            
                        /lightning/cmp/omnistudio__vlocityLWCOmniWrapper?                                 c__target=c:demoWorkEnglish&c__layout=lightning&c__tabIcon=custom:custom18&c__ContextId={0}
=========================================================================
Embedded:

You can embed the component into any Aura or LWC component using the component tag. The component attribute "prefill" accepts string or javascript object.
Examples:

<c-type--sub-type-english prefill={prefill} layout="lightning"></c-type--sub-type-english>

<c-type--sub-type-english prefill='\{"ContextId":"abc","otherParam":"FAQ"}' layout="newport"></c-type--sub-type-english>
=========================================================================

In upcoming post i will let you know how to use flow for launching omniscript.

For more Details about DataRaptors and Types check this link DataRaptors
For OmniScripts elements refer this link OmniScript Elements -1
Best Practices of OmniScript, Integration Procedure, Data Raptors
Debugging Angular OmniScript. 

Comments

Popular posts from this blog

Vlocity Facts #01 | OmniStudio DataRaptors

Vlocity Facts #34 || Getting the details from the URL in a FlexCard and an Omniscript

Vlocity Facts #44 || Communication between Omniscript and Flexcard [Pub/Sub]