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)
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 :
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")
4. It will automatically assign and store it as a variable (for example here its temp1)
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"
7. Now open any JSON Formatter tool or your VS Code and paste there to view the Omni Data JSON.
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 :
4. Now copy complete json in message (you can right click and select "Copy value" option.
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
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.
Another very important feature is to quickly find and open any OmniStudio element and event execute IP, DR without opening them!
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
Desenvolvedor Salesforce | GLOBAL HITSS
3 个月Thanks for sharing this article, it just helped me a lot!!!
Salesforce Technical Lead || 5x Salesforce Certified
3 个月Very informative
Lead Salesforce Developer Instructor at Revolent Group
4 个月This is great, it works perfectly with Experience Sites as well
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/