---
schema_version: "1"
id: 407d968fb1a5cfdd28b63c4efd9a0267b17d93aca567f106567f0abb10e29007
title: Common Action Utility for Remote Calls (Managed Package)
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/os_common_action_utility_remote_calls_vlocity.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.os_common_action_utility_remote_calls_vlocity.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 8930e0e5e6660070dfd6dc08a1b82cac2f93c59e7763eacbc7d085845d159e14
description: For the managed package runtime, make remote calls from any custom LWC using the Common Action Utility. The Common Action Utility relies on the Vlocity Action Framework to make remote calls without the dependency of a strict Omniscript data structure.
products:
  - Omnistudio
release: "264"
---
# Common Action Utility for Remote Calls (Managed Package)

For the managed package runtime, make remote calls from any custom LWC using the Common Action Utility. The Common Action Utility relies on the Vlocity Action Framework to make remote calls without the dependency of a strict Omniscript data structure.

![Managed Package app icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/resources-global/_corporate/images/managedpackageicon.png) This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see [Omnistudio Help](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_standard.htm&language=en_US).

- Utility: `omniscriptActionUtils`
- Utility Class Name: `OmniscriptActionCommonUtil`

## Defined Methods and Available Variables (Managed Package)

For the managed package runtime, review the available methods and variables for remote calls.

![Managed Package app icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/resources-global/_corporate/images/managedpackageicon.png) This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see [Omnistudio Help](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_standard.htm&language=en_US).

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
          <colgroup>
            <col>
            <col>
            <col>
            <col>
          </colgroup>
          <thead class="slds-text-title_caps ">
            <tr class="">
              <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d320399e100">
                <p style="margin-bottom:0;">Method Name</p>
              </th>
              <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d320399e106">
                <p style="margin-bottom:0;">Description</p>
              </th>
              <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d320399e112">
                <p style="margin-bottom:0;">Argument - Data Type</p>
              </th>
              <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d320399e118">
                <p style="margin-bottom:0;">Returns</p>
              </th>
            </tr>
          </thead>
          <tbody>
            <tr class="">
              <td data-label="Method Name" class="slds-cell-wrap" style="vertical-align:top;" headers="d320399e100 ">
                <p style="margin-bottom:0;">executeAction</p>
              </td>

              <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d320399e106 ">
                <p style="margin-bottom:0;">Begins the execution of an action flow.</p>
              </td>

              <td data-label="Argument - Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d320399e112 ">
                <ul>
                  <li>
                    <p>params - object</p>
                  </li>

                  <li>
                    <p>queueableId - string</p>
                  </li>

                  <li>
                    <p>comp - component</p>
                  </li>

                  <li>
                    <p>payload - object</p>
                  </li>

                  <li>
                    <p>vlcParams - object</p>
                  </li>

                </ul>
              </td>

              <td data-label="Returns" class="slds-cell-wrap" style="vertical-align:top;" headers="d320399e118 ">
                <p style="margin-bottom:0;">promise</p>
              </td>

            </tr>
            <tr class="">
              <td data-label="Method Name" class="slds-cell-wrap" style="vertical-align:top;" headers="d320399e100 ">
                <p style="margin-bottom:0;">handleActionEvents</p>
              </td>

              <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d320399e106 ">
                <p>Handles action events once the remote call obtains a response. It can be configured
                  to send events to the Omniscript Designer Debug console. Configured for sending
                  pubsub events.</p>
                <p style="margin-bottom:0;">In LWC, if&nbsp;sendDataToDebugConsole&nbsp;is defined in the component, event logs can be
                  sent to the Debug Console in the Omniscript Designer. If the component is not in
                  Omniscript, define&nbsp;_debugLabel in the component populate the debug log event name.
                  If from omniscript, the debug log event name is populated from the label property in
                  the element's property set.</p>
              </td>

              <td data-label="Argument - Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d320399e112 ">
                <ul>
                  <li>
                    <p>comp - component</p>
                  </li>

                  <li>
                    <p>resp - object</p>
                  </li>

                  <li>
                    <p>params - object</p>
                  </li>

                  <li>
                    <p>element - object</p>
                  </li>

                </ul>
              </td>

              <td data-label="Returns" class="slds-cell-wrap" style="vertical-align:top;" headers="d320399e118 ">
                <p style="margin-bottom:0;">void</p>
              </td>

            </tr>
            <tr class="">
              <td data-label="Method Name" class="slds-cell-wrap" style="vertical-align:top;" headers="d320399e100 ">
                <p style="margin-bottom:0;">invokeAction</p>
              </td>

              <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d320399e106 ">
                <p style="margin-bottom:0;">Method that invokes an Apex class or a Promise resolution using an action
                  transformed request.</p>
              </td>

              <td data-label="Argument - Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d320399e112 ">
                <ul>
                  <li>
                    <p>data - object</p>
                  </li>

                  <li>
                    <p>comp - component</p>
                  </li>

                  <li>
                    <p>(optional) payload - object</p>
                  </li>

                </ul>
              </td>

              <td data-label="Returns" class="slds-cell-wrap" style="vertical-align:top;" headers="d320399e118 ">
                <p style="margin-bottom:0;">promise</p>
              </td>

            </tr>
            <tr class="">
              <td data-label="Method Name" class="slds-cell-wrap" style="vertical-align:top;" headers="d320399e100 ">
                <p style="margin-bottom:0;">postProcess</p>
              </td>

              <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d320399e106 ">
                <p>Post-processes remote call response for both successful and failed remote calls and
                  returns a post-processed response. The return contains an object with the key
                  nodes:</p>
                <ul>
                  <li>
                    <p>result: stores the remote call's raw response</p>
                  </li>

                  <li>
                    <p>error: boolean</p>
                  </li>

                </ul>
              </td>

              <td data-label="Argument - Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d320399e112 ">
                <ul>
                  <li>
                    <p>resp - object</p>
                  </li>

                  <li>
                    <p>element - object</p>
                  </li>

                  <li>
                    <p>comp - component</p>
                  </li>

                  <li>
                    <p>(optional) failure - boolean</p>
                  </li>

                </ul>
              </td>

              <td data-label="Returns" class="slds-cell-wrap" style="vertical-align:top;" headers="d320399e118 ">
                <p style="margin-bottom:0;">object</p>
              </td>

            </tr>
            <tr class="">
              <td data-label="Method Name" class="slds-cell-wrap" style="vertical-align:top;" headers="d320399e100 ">
                <p style="margin-bottom:0;">preProcess</p>
              </td>

              <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d320399e106 ">
                <p style="margin-bottom:0;">Preprocesses remote call parameters before invoking an action.</p>
              </td>

              <td data-label="Argument - Data Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d320399e112 ">
                <ul>
                  <li>
                    <p>params - object</p>
                  </li>

                  <li>
                    <p>queueableRespId - string</p>
                  </li>

                  <li>
                    <p>comp - component</p>
                  </li>

                  <li>
                    <p>payload - object</p>
                  </li>

                  <li>
                    <p>vlcParams - object</p>
                  </li>

                </ul>
              </td>

              <td data-label="Returns" class="slds-cell-wrap" style="vertical-align:top;" headers="d320399e118 ">
                <p style="margin-bottom:0;">object</p>
              </td>

            </tr>
          </tbody>
        </table> <table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
          <colgroup>
            <col>
            <col>
          </colgroup>
          <thead class="slds-text-title_caps ">
            <tr class="">
              <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d320399e420">
                <p style="margin-bottom:0;">Variable Name</p>
              </th>
              <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d320399e426">
                <p style="margin-bottom:0;">Description</p>
              </th>
            </tr>
          </thead>
          <tbody>
            <tr class="">
              <td data-label="Variable Name" class="slds-cell-wrap" style="vertical-align:top;" headers="d320399e420 ">
                <p style="margin-bottom:0;">_ns</p>
              </td>

              <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d320399e426 ">
                <p style="margin-bottom:0;">Namespace in dot notation</p>
              </td>

            </tr>
            <tr class="">
              <td data-label="Variable Name" class="slds-cell-wrap" style="vertical-align:top;" headers="d320399e420 ">
                <p style="margin-bottom:0;">_element</p>
              </td>

              <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d320399e426 ">
                <p style="margin-bottom:0;">(Optional) Omniscript element JSON definition</p>
              </td>

            </tr>
          </tbody>
        </table>

## Implementing the Common Action Utility (Managed Package)

For the managed package runtime, import the Common Action Utility into your Lightning Web component so that you can make remote calls.

![Managed Package app icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/resources-global/_corporate/images/managedpackageicon.png) This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see [Omnistudio Help](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_standard.htm&language=en_US).

1. Obtain the dot notation format of the namespace in your LWC by importing `getNamespaceDotNotation` from `omniscriptInternalUtils`. Replace **NS** in the first line of code with the namespace of your package.
    
    ![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/images/icon_note.png)
    
    Note
    
    Remote calls made to Apex classes inside a vlocity managed package must include the namespace in the sClassName parameter sent into the `executeAction`.
    
    ```
    import { getNamespaceDotNotation } from 'NS/omniscriptInternalUtils'; 
    _ns = getNamespaceDotNotation();
    ```
2. Import `OmniscriptActionCommonUtil` into your LWC from the utility class `omniscriptActionUtils`. Replace **NS** in the first line of code with the namespace of your package.
    
    ```
    import { OmniscriptActionCommonUtil } from 'NS/omniscriptActionUtils';
    ```
3. Create an instance of the OmniscriptActionCommonUtil javascript class.
    
    ```
    this._actionUtilClass = new OmniscriptActionCommonUtil();
    ```
4. Use the OmniscriptActionCommonUtil methods to execute remote calls to the server.
    
    - The most common flow is to use the `executeAction` method. This method starts the remote call flow, and the response callback from `executeAction` returns an object that has these properties:
        
        - result: Contains the response from the remote call.
        - error: Contains a boolean indicating the invoke status of GenericInvoke2.
    - Parameters sent into the `executeAction` must be in an object format. The object must have the following keys:
        
        - input
        - sClassName
        - sMethodName
        - options
        
        Each key requires a stringified value.
    - If the LWC displays in the Omniscript Designer, it is possible to send events to the Debug Console. Send events to the Debug Console by including the `sendDataToDebugConsole` method in your LWC. The method provides logic on sending events to the Debug Console. `sendDataToDebugConsole` accepts these arguments:
        
        - params
        - resp
        - label

![Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/images/icon_example.png)

Example

- Sample remote call using **executeAction**:
    
    ```
    connectedCallback() {
        this._actionUtilClass = new OmniscriptActionCommonUtil();
    }
    
    triggerRemote() {
        const params = {
            input: '{}',
            sClassName: 'LwcTest',
            sMethodName: 'lwctest',
    		options: '{}',
        };
    
        this._actionUtilClass
            .executeAction(params, null, this, null, null)
            .then(response => {
    			window.console.log(response);
            })
    		.catch(error => {
    			window.console.log(error);
            });
    }
    ```
- Sample **sendDataToDebugConsole** method:
    
    ```
    sendDataToDebugConsole(params, resp, label) {
    	let sendParams = JSON.parse(JSON.stringify(params));
        if (sendParams && sendParams.options) {
        	let optionNode = JSON.parse(sendParams.options);
            delete optionNode.options;
            delete optionNode.input;
            sendParams.options = optionNode;
        }
        let sendResp = JSON.parse(JSON.stringify(resp));
    
    	// for queueable support
        if (sendResp && sendResp.responseResult) {
             sendResp.responseResult = JSON.parse(sendResp.responseResult);
        }
    
        // dispatches action data to debug console
        const debugEvent = new CustomEvent('omniactiondebug', {
            bubbles: true,
            cancelable: true,
            composed: true,
            detail: {
            	params: sendParams,
            	response: sendResp,
            	element: { label: label },
        	},
        });
        this.dispatchEvent(debugEvent);
    }
    ```
- Sample **queueable** remote call using **executeAction**:
    
    ```
    connectedCallback() {
        this._actionUtilClass = new OmniscriptActionCommonUtil();
    }
    
    triggerQueueable() {
        const options = {
            input: '{}',
            vlcClass: 'LwcTest',
            vlcMethod: 'lwctest',
            useQueueableApexRemoting: true,
        };
        const params = {
            input: '{}',
            sClassName: `${this._ns}VFActionFunctionController.VFActionFunctionControllerOpen`,
            sMethodName: 'runActionFunction',
            options: JSON.stringify(options),
        };
        this._actionUtilClass
            .executeAction(params, null, this, null, null)
            .then(response => {
                window.console.log(response);
            })
            .catch(error => {
                window.console.log(error, 'error');
            });
    }
    ```
- Sample **continuation** remote call using **executeAction**:
    
    ```
    connectedCallback() {
        this._actionUtilClass = new OmniscriptActionCommonUtil();
    }
    
    triggerContinuation() {
        const options = {
            input: '{}',
            vlcClass: 'QeRemoteAction2',
            vlcMethod: 'populateElements',
            useContinuation: true,
        };
        const params = {
            input: JSON.stringify(this.omniJsonData),
            sClassName: 'QeRemoteAction2',
            sMethodName: 'populateElements',
            options: JSON.stringify(options),
        };
        this._actionUtilClass
            .executeAction(params, null, this, null, null)
            .then(response => {
    			window.console.log(response);
            })
            .catch(error => {
                window.console.log(error, 'error');
            });
    }
    ```
- Sample **future** remote call using **executeAction**:
    
    ```
    connectedCallback() {
        this._actionUtilClass = new OmniscriptActionCommonUtil();
    }
    
    triggerFuture() {
        const options = {
            useFuture: true,
        };
        const params = {
            input: '{}',
            sClassName: `${this._ns}IntegrationProcedureService`,
            sMethodName: 'Test_Chainable',
            options: JSON.stringify(options),
        };
        this._actionUtilClass
            .executeAction(params, null, this, null, null)
            .then(response => {
    			window.console.log(response);
            })
            .catch(error => {
                window.console.log(error, 'error');
            });
    }
    ```
- Sample **chainable** remote call using **executeAction**:
    
    ```
    connectedCallback() {
        this._actionUtilClass = new OmniscriptActionCommonUtil();
    }
    
    triggerChainable() {
            const options = {
                chainable: true,
            };
            const params = {
                input: '{}',
                sClassName: `${this._ns}IntegrationProcedureService`,
                sMethodName: 'Test_Chainable',
                options: JSON.stringify(options),
            };
            this._actionUtilClass
                .executeAction(params, null, this, null, null)
                .then(response => {
    				window.console.log(response);
                })
                .catch(error => {
                    window.console.log(error, 'error');
                });
        }
    ```
- Sample **parameters** for a remote call from inside a Vlocity package:
    
    ```
    const params = {
        input: '{}',
        sClassName: `${this._ns}IntegrationProcedureService`,
        sMethodName: 'Test_Chainable',
        options: '{chainable: true}',
    };
    ```