How to Debug OmniScript in Runtime Mode

How to Debug OmniScript in Runtime Mode

OOTB available options to debug OmniScript :

If you use OmniStudio OmniScripts for guided flows, then you must be familiar with "Data JSON" from preview mode where you can check Omni Data JSON that is present for that OmniScript. When in preview mode, its very easy to debug and check what data is being created, passed or present. (through OmniScript Designer, reference images below)

Salesforce OmniScript Debugger
OmniScript Data JSON (Preview Mode)
Action Debugger
Action Debugger to check any Remote Action, Integration Procedure callouts etc. (Preview Mode)

Now this is helpful when you have access to OmniScript designer and data to mess around on lower orgs but on higher orgs you just can't play with data as well as OmniScript itself, all you can do is debug once it is rendered on UI (Runtime Mode)

So at the moment there is no official documentation from Salesforce to debug OmniScripts / FlexCards in Runtime mode but there are couple of tricks that we can use to find the "Data JSON" and "Action Debugger" event details.

Debugging OmniScript in Runtime to Get Data JSON :

  1. Let your page with OmniScript render completely first.
  2. Now Right click, goto inspect element, select the cursor on left side near "Elements", and hover little above the Step Name (in below example, it is "Input Details") and stop once you see the element : "vlocity_cmt-omniscript-step" this is for managed package runtime (Vlocity) and for Standard Runtime it will be "runtime_omnistudio_omniscript-omniscript-step" (Basically stop for the element which contains step keyword)

Debugging Salesforce OmniScript in Runtime Mode

3. Right click that step element and then select "Store as global variable" (Note : I will recommend to use Google Chrome, although if you use FireFox then it will be "Use in Console")

Store as global variable in Google Chrome

4. It will automatically assign and store it as a variable (for example here its temp1)

Temp Variable

5. Now just type your_variable.jsonData (in example it is temp1.jsonData) and hit enter to get the object. (You can also use JSON.Stringify(temp1.jsonData) to print direct json value)

6. Right click on it and select "Copy Object"

Copy JSON Object

7. Now open any JSON Formatter tool or your VS Code and paste there to view the Omni Data JSON.

Final Data JSON from OmniScript

This is how you can get the Data JSON from OmniScript for that step, so for every step you can get data from previous step as well, If you want to debug the complete OmniScript then just simply perform these steps on last OmniScript Step Item.

Huge thanks to Megha Badwaik for teaching me this trick!

How to debug OmniScript to Get Action Data (Events) :

If you are triggering any IP, Remote Action, DR from OmniScript then you can also get the details from Network tab, below is an example to get details from an Integration Procedure which is executed after clicking next button (IP is between 2 steps)

Update on 15 Dec 2024 : I have created a chrome extension "Salesforce OmniStudio Network Logger" to automate all below steps so feel free to use it and share your review!

Steps to debug OmniScript Actions/Events using Chrome DevTools :

  1. Before your event / action, right click and open inspect element, goto Network tab and clear any requests if you find any existing ones (Just to avoid confusion) and then trigger the action / event (If you have any button or next button etc)
  2. Once the action/ event is executed, you will see something like "aura?r=475&aura.ApexAction.execute=1" here r=475 will be always incremental but all you need to look for is "ApexAction.execute"
  3. Click on it and goto Payload tab, you will see Form Data and message inside it.

Apex Action Request in Network Tab

4. Now copy complete json in message (you can right click and select "Copy value" option.

JSON data from Request

5. I have created a web tool to format this JSON in readable format, goto OmniScript Input JSON Formatter and paste your JSON there.

6. You will find the input for your IP and the IP name as well (I will be updating the app with other Action types to support DR, Remote Actions etc)

Below is the JSON Data that is passed to the IP from Runtime Mode

Runtime JSON
IP Configuration in OmniScript for Reference

This is how you can debug OmniScript in Runtime mode (for both Vlocity or Standard Runtime)

Hope you learnt something new today! I will be posting a video tutorial on my YouTube Channel - That Salesforce Guy soon so stay tuned!

Bonus : I have also created a chorme extension OmniStudio Helper you can install this and find what OmniScript / FlexCards are rendered on the current page.

OmniStudio Helper

Another very important feature is to quickly find and open any OmniStudio element and event execute IP, DR without opening them!

OmniStudio Helper


Rohitkumar Asare

Salesforce Developer | 13x Certified | YouTuber | Blogger

3 个月

Update : I have created a chrome extension for getting OmniScript / FlexCard Actions from Network Tab. Check it out at Chrome Web Store : https://chromewebstore.google.com/detail/salesforce-omnistudio-net/gnldglohmhcppaebjjkcgbhdpffblbnn

回复
Gabriel Topini

Desenvolvedor Salesforce | GLOBAL HITSS

3 个月

Thanks for sharing this article, it just helped me a lot!!!

Nipun Phutela

Salesforce Technical Lead || 5x Salesforce Certified

3 个月

Very informative

Jack Hilburn

Lead Salesforce Developer Instructor at Revolent Group

4 个月

This is great, it works perfectly with Experience Sites as well

Rohitkumar Asare

Salesforce Developer | 13x Certified | YouTuber | Blogger

4 个月

I created an AI Podcast for this video haha, check it out --> https://www.dhirubhai.net/feed/update/urn:li:activity:7263864837141635072/

回复

要查看或添加评论,请登录

社区洞察

其他会员也浏览了