Salesforce OmniStudio
Jitendra's Blog
COMPLETE DEVELOPER GUIDE

OmniScript Debugging Methods

Master all debugging techniques for Salesforce OmniScript - from built-in tools to advanced browser debugging and third-party solutions

10+
Debugging Methods
4
Chrome Extensions
2
Built-in Debuggers
3
Runtime Modes

1 Built-in OmniScript Designer Tools

OmniStudio provides two primary built-in debugging tools directly within the OmniScript Designer. These tools are your first line of defense when troubleshooting OmniScript issues.

Data JSON Panel Built-in

The Data JSON panel displays the real-time data structure formed by JSON code during OmniScript execution, as detailed in OmniScript advanced concepts.

  • View and confirm keys and their values
  • JSON updates automatically when values are entered in data fields
  • Copy entire JSON with a single click for testing
  • Easy-to-read format for quick validation

Action Debugger Built-in

Displays a searchable log of every action that runs, with detailed request/response data per Salesforce best practices.

  • Debug action requests and response data
  • Search for specific actions in the log
  • Expand nodes to see data sent to/from servers
  • Copy specific nodes with one click
  • Clear console log as needed

Preview Mode Features

The Preview functionality offers several debugging-adjacent capabilities as shown in the Trailhead OmniScript tutorial:

OmniScript Designer Preview Mode with Data JSON and Action Debugger panels
Image #1: OmniScript Designer showing the Preview canvas with Data JSON panel (left) displaying real-time JSON data structure, and Action Debugger panel (right) for monitoring action requests and responses.
Pro Tip In the Action Debugger, you can confirm the actual value sent at runtime in the preview. The JSON shows the values sent to the service, including dynamically set options as explained in Trailhead's JSON preparation guide.

2 Browser DevTools for OmniStudio

Since OmniScript code executes on the client side, browser developer tools become essential for debugging. This section covers OmniStudio-specific JavaScript techniques to extract the complete page payload.

Get Complete OmniScript JSON Payload

Use these JavaScript commands in the browser console to extract the entire OmniScript data payload, as demonstrated in Rohitkumar Asare's debugging guide:

Method 1: Query All OmniScript Components
// Get all OmniScript step elements on the page
// For Standard Runtime (omnistudio namespace):
document.querySelectorAll('runtime_omnistudio-omniscript-step')

// For Vlocity/Managed Package Runtime:
document.querySelectorAll('vlocity_cmt-omniscript-step')

// Get the first OmniScript step and access its JSON data:
let osStep = document.querySelector('runtime_omnistudio-omniscript-step');
console.log(osStep.jsonData);

// Pretty print the entire JSON payload:
JSON.stringify(osStep.jsonData, null, 2)
Method 2: Store Element as Global Variable
// Step 1: Open DevTools (F12) > Elements tab
// Step 2: Use element selector and find omniscript-step element
// Step 3: Right-click > "Store as global variable" (creates temp1)

// Step 4: Access the JSON data in Console:
temp1.jsonData

// Step 5: Get formatted JSON output:
JSON.stringify(temp1.jsonData, null, 2)

// Step 6: Copy to clipboard:
copy(JSON.stringify(temp1.jsonData, null, 2))
OmniScript Runtime Debugging - Access jsonData via Browser Console
Image #2: Right-click on the OmniScript step element in DevTools Elements panel and select "Store as global variable" to create temp1. Then in Console, type temp1.jsonData to access the complete OmniScript JSON payload.
Method 3: Access OmniScript from LWC Context
// If you have a custom LWC in the OmniScript, access via:
this.omniJsonData           // Returns the parsed JSON object
this.omniJsonDataStr        // Returns JSON as string

// Example in connectedCallback:
connectedCallback() {
    console.log('Full OmniScript Data:', this.omniJsonData);
    console.log('Specific field:', this.omniJsonData.Step1.FieldName);
}

// Push data back to OmniScript:
this.omniUpdateDataJson({ myField: 'newValue' });

// Apply response from external call:
this.omniApplyCallResp({ responseData: myData });

Network Tab - Capture OmniStudio Requests

Monitor network requests to debug Integration Procedures, Remote Actions, and Data Raptors:

Network Tab Steps for OmniStudio
1. Open DevTools (F12) > Network tab
2. Clear existing requests before triggering the action
3. Trigger the OmniScript action (button click, step navigation)
4. Filter by "Fetch/XHR" to see API calls
5. Look for ApexAction requests containing:
   "aura?r=XXX&aura.ApexAction.execute=1"
6. Click the request > Payload tab > Form Data
7. Find "message" field containing the JSON payload
8. Copy and use a JSON formatter to decode
OmniScript Network Tab Debugging - Payload Message JSON Data
Image #3: In the Network tab, click on the aura?r=XX&aura.ApexAction.execute=1 request, then select the Payload tab. Under Form Data, locate the message field which contains the complete JSON payload with namespace, classname, method, and params sent to Integration Procedures or Remote Actions.

OmniScriptBaseMixin Methods Reference

Available methods when extending OmniScriptBaseMixin in custom LWC components, documented at Salesforce Ben:

Method/Property Description Usage
omniJsonData Get OmniScript JSON as object this.omniJsonData
omniJsonDataStr Get OmniScript JSON as string this.omniJsonDataStr
omniUpdateDataJson() Update data in OmniScript JSON this.omniUpdateDataJson({key: value})
omniApplyCallResp() Push external response to OmniScript this.omniApplyCallResp(responseObj)
omniNextStep() Navigate to next step this.omniNextStep()
omniPrevStep() Navigate to previous step this.omniPrevStep()
Pro Tip: Quick Console Access For the fastest access to OmniScript JSON, right-click on any OmniScript step in Elements panel, select "Store as global variable", then type temp1.jsonData in Console. This works in any environment including production.

3 Chrome Extensions for OmniStudio

Several Chrome extensions have been developed to streamline OmniStudio debugging, making it easier to inspect requests, identify components, and analyze data flow. These are available in the Chrome Web Store.

OmniStudio Network Logger Extension

1,000 users 5.0 (4 reviews)

Captures and logs network requests made by OmniStudio components.

  • Automatically captures FlexCard and OmniScript requests
  • Logs Integration Procedures, Remote Actions, Data Raptors
  • Robust search and filtering options
  • Dark mode support for low-light conditions

OmniStudio Helper Extension

196 users No ratings yet

One-click access to OmniStudio components and in-page identification.

  • Find FlexCards and OmniScripts on active page
  • Access latest active versions instantly
  • Execute IP/DR directly from extension
  • Supports LWC and Standard Runtime

OmniStudio Explorer Extension

3,000 users 5.0 (1 review)

Identify OmniStudio components on Salesforce or Experience Cloud pages.

  • Identify Cards (AngularJS)
  • Detect FlexCards and OmniScripts
  • Find custom Lightning Web Components
  • Works with both AngularJS and LWC

OmniStudio Addons Extension

449 users 5.0 (3 reviews)

Compare and search across OmniStudio components and orgs.

  • Compare OmniScripts between orgs
  • Compare Integration Procedures and FlexCards
  • Quick search within elements and Data JSON
  • Faster debugging and development

4 Integration Procedure Debugging

Integration Procedures (IPs) have their own dedicated debugging tools within OmniStudio, allowing you to test and troubleshoot data flow between components as covered in the Trailhead Integration Procedures module.

Preview Tab Testing

The Preview tab in the Integration Procedure designer provides comprehensive testing capabilities:

Debug Log / Errors Panel

The Errors/Debug Output panel helps identify issues with each element, as described in Perficient's Integration Procedures guide:

Debug Log Structure
The Debug Log includes two entries for each element:

NAME        - Shows the OUTPUT of the element
NAMEDebug   - Shows the INPUT for the step

Example:
AccountExtract      - Output data from DataRaptor
AccountExtractDebug - Input parameters sent to DataRaptor

If you don't see expected outputs, review the debug entry
to find what's wrong with the input data.

Response Action Debugging

The Response Action in an Integration Procedure serves multiple debugging functions:

Common Issue If you see data extracted by the DataRaptor in the Debug Log but the response is empty, it's likely that a Response Action was not added to the Integration Procedure.

5 Apex & Debug Logs

When OmniScripts call Remote Actions or Apex classes, standard Salesforce debug logs become essential for troubleshooting server-side logic.

Setting Up Trace Flags

Configure trace flags to capture debug logs for specific users or processes:

Trace Flag Setup Steps
1. Go to Setup > Debug Logs
2. Click "New Trace Flag"
3. Select Traced Entity Type:
   - User: Monitor specific user's activity
   - Apex Class: Log events for specific Apex class
   - Apex Trigger: Log events for specific trigger
   - Automated Process: For platform events and async processes
4. Set Debug Level (determines logging granularity)
5. Set Start Date and Expiration Date
6. Click Save

Debug Levels

Level Description Use Case
FINEST Most detailed information Deep debugging of complex issues
DEBUG General debugging information Standard troubleshooting
INFO Operational messages Monitoring execution flow
WARN Warnings needing attention Identifying potential issues
ERROR Errors causing operation failure Critical issue identification

Remote Action Apex Class

When creating Apex classes for OmniStudio Remote Actions, implement the proper Callable interface:

Remote Action Apex Class Example
global with sharing class MyOmniScriptAction implements Callable {

    // Required method for Callable interface
    public Object call(String action, Map<String, Object> args) {
        Map<String, Object> input = (Map<String, Object>)args.get('input');
        Map<String, Object> output = (Map<String, Object>)args.get('output');
        Map<String, Object> options = (Map<String, Object>)args.get('options');

        // Add debug statements
        System.debug('Input: ' + JSON.serialize(input));

        return invokeMethod(action, input, output, options);
    }

    public Boolean invokeMethod(String methodName, Map<String, Object> input,
            Map<String, Object> output, Map<String, Object> options) {

        if (methodName == 'myAction') {
            // Your logic here
            System.debug('Executing myAction');
            output.put('result', 'Success');
            return true;
        }

        return false;
    }
}
Trace Flag Expiration Trace Flags have an expiration date/time. If logs stop appearing mysteriously, check if the Trace Flag has expired and extend it as needed.

Debug OmniScript Input - Print All Parameters

One of the most useful debugging techniques is creating a simple Apex class that receives OmniScript input parameters and prints them exactly as received. This helps you understand the exact data structure being passed from OmniScript:

OmniScript Debug Helper Apex Class
global with sharing class OmniScriptDebugHelper implements Callable {

    /**
     * Debug helper class that prints all OmniScript input parameters
     * to the debug log exactly as received. Use this in Remote Actions
     * to see the complete data payload from OmniScript.
     */

    public Object call(String action, Map<String, Object> args) {
        Map<String, Object> input = (Map<String, Object>)args.get('input');
        Map<String, Object> output = (Map<String, Object>)args.get('output');
        Map<String, Object> options = (Map<String, Object>)args.get('options');

        return invokeMethod(action, input, output, options);
    }

    public Boolean invokeMethod(String methodName, Map<String, Object> input,
            Map<String, Object> output, Map<String, Object> options) {

        // Print the complete input JSON exactly as received
        System.debug('========== OMNISCRIPT DEBUG START ==========');
        System.debug('Method Name: ' + methodName);
        System.debug('----------------------------------------');
        System.debug('COMPLETE INPUT JSON:');
        System.debug(JSON.serializePretty(input));
        System.debug('----------------------------------------');
        System.debug('OPTIONS:');
        System.debug(JSON.serializePretty(options));
        System.debug('========== OMNISCRIPT DEBUG END ==========');

        // Return the input back to OmniScript for verification
        output.put('debugInput', input);
        output.put('debugMethod', methodName);
        output.put('debugTimestamp', System.now());

        return true;
    }
}
Usage Tip Add this class as a Remote Action in your OmniScript, then open the Debug Logs in Salesforce Setup. When the action executes, you'll see the complete JSON payload formatted clearly in the logs. This is especially useful when troubleshooting data mapping issues between OmniScript steps and server-side actions.

6 Custom LWC Debugging

When extending OmniScript with custom Lightning Web Components, specific debugging techniques apply to ensure your components work correctly within the OmniScript context.

OmniScriptBaseMixin

Custom LWCs for OmniScript must extend OmniScriptBaseMixin instead of LightningElement:

Custom LWC Template
import { OmniScriptBaseMixin } from 'omnistudio/omniscriptBaseMixin';

export default class MyCustomComponent extends OmniScriptBaseMixin {

    connectedCallback() {
        super.connectedCallback();

        // Access OmniScript data JSON
        console.log('OmniScript Data:', this.omniJsonDataStr);

        // Parse the JSON data
        const omniData = JSON.parse(this.omniJsonDataStr);
        console.log('Parsed Data:', omniData);
    }

    renderedCallback() {
        // Debug after render
        console.log('Component rendered');
    }

    handleClick() {
        // Update OmniScript data
        this.omniUpdateDataJson({
            myField: 'newValue'
        });

        console.log('Data updated');
    }
}

Common console.log Issues

If console.log statements aren't appearing, check these common causes:

Issue Cause Solution
Logs not appearing Console filter set incorrectly Set console to "All levels" or "Verbose"
Constructor logs missing Component not fully initialized Use connectedCallback() or renderedCallback() instead
No logs at all Component not rendered on page Verify component is added to Lightning page/app
Conditional render issues Render conditions not met Check visibility conditions are satisfied
Debugging Tip Use the debugger; statement to pause execution and inspect variables directly in browser DevTools. This is often more effective than multiple console.log statements.

7 Best Practices & Tips

Follow these best practices to make OmniScript debugging more efficient and effective.

Development Best Practices

Modular Design

Break complex OmniScripts into smaller, modular components for easier debugging as recommended by Apex Hours.

  • Use sub-flows for reusable functionality
  • Create separate Integration Procedures for each data operation
  • Isolate complex logic for targeted testing

Error Handling

Implement comprehensive error handling to catch and surface issues early per Cloud Foundation's guide.

  • Use try-catch blocks in Integration Procedures
  • Implement Rollback on Error for data consistency
  • Create informative error messages for users

Prerequisite Validation

Verify dependencies before building complex OmniScripts as noted in Perficient's comprehensive guide.

  • Test DataRaptors independently first
  • Verify Integration Procedures work correctly
  • Activate DataRaptors after preview testing

Clean Apex Code

Maintain clean, testable Apex code for Remote Actions.

  • Create separate classes for different OmniScripts
  • Avoid putting all logic in one super class
  • Write unit tests for each Apex class

Debugging Checklist

Step Tool/Method Purpose
1 Data JSON Panel Verify data structure and values
2 Action Debugger Check request/response for actions
3 Browser Console Look for JavaScript errors
4 Network Tab Inspect API calls and responses
5 IP Debug Log Review Integration Procedure steps
6 Salesforce Debug Logs Debug Apex/Remote Actions
7 Chrome Extensions Automated request logging
Quick Tip When troubleshooting in production, use the Browser DevTools technique (Section 2) with temp1.jsonData combined with the OmniStudio Network Logger extension (Section 3) for comprehensive visibility without needing Designer access.

Common Issues and Solutions

Issue Likely Cause Solution
Preview works but runtime fails Missing dependencies in target org Run smoke tests on all components
FlexCard not displaying data Empty Data Node field or wrong RecordId Check Data Node configuration and Test Data Source
Integration Procedure response empty Missing Response Action Add Response Action to IP
APEX CPU limit exceeded Inefficient DataRaptor or complex logic Review DataRaptor config, use Action Debugger
Chainable IP not working Chainable option not enabled Enable "Chainable" in Remote Properties

Complete Debugging Methods Summary

# Method Type Best For Environment
1 Data JSON Panel Built-in Real-time data structure validation Designer Preview
2 Action Debugger Built-in Action request/response inspection Designer Preview
3 Browser Console (jsonData) Browser Runtime JSON access via temp1.jsonData All environments
4 Network Tab Browser API calls, payload inspection All environments
5 OmniStudio Network Logger Extension Automated request capture All environments
6 OmniStudio Helper Extension Component identification All environments
7 IP Debug Log Built-in Integration Procedure step debugging Designer Preview
8 Apex Debug Helper Class Apex Print all OmniScript params to logs All environments
9 Salesforce Debug Logs Apex Server-side Apex debugging All environments
10 LWC Lifecycle Hooks Browser Custom component debugging All environments
Link copied to clipboard!
Previous Post
ServiceNow Release Timeline & Upgrade Guide
Next Post
Salesforce Security Ultimate Guide
Archives by Year
2025 16 2024 2 2023 9 2022 8 2021 4 2020 18 2019 16 2018 21 2017 34 2016 44 2015 54 2014 30 2013 31 2012 46 2011 114 2010 162
Search Blog

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Jitendra Zaa

Subscribe now to keep reading and get access to the full archive.

Continue Reading