Remote Calls (Managed Package)

For the managed package runtime, beginning with Vlocity Insurance and Health Winter '20 , enable users to make remote calls from a Custom LWC by using the omniRemoteCall() method.

Managed Package app icon This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see Omnistudio Help.

Method: omniRemoteCall(params, boolean)

Arguments:

  • The first argument must be an object with the properties input, sClassName, sMethodName, and options. The values of each of the properties must be in String data type.
    Note
    Note Methods called within a package must have the namespace prepended with ${this._ns}. For example, `${this._ns}IntegrationProcedureService`.
    const params = {
    	input: JSON.stringify(this.omniJsonData),
    	sClassName: 'SomeApexClass',
    	sMethodName: 'someApexMethod',
    	options: '{}',
    };
  • The second argument for omniRemoteCall is an optional boolean value that links a tracked property called omniSpinnerEnabled. The HTML must have some code to check the boolean's value.

    Here’s an HTML example:

    <template if:true={omniSpinnerEnabled}>
          <div class="slds-spinner-container__wrapper">
            <c-spinner variant="brand"
                       alternative-text="Loading.."
                       size="medium">
            </c-spinner>
          </div>
    </template>

After omniRemoteCall executes, the response callback returns an object containing the two properties result and error.

  • result: The result property contains a raw response from the server.
  • error: The error property stores an error value from the Vlocity's GenericInvoke2 class.

Vlocity provides properties that, when passed in the options, enable jobs to be queuable, future, chainable, and continuable.

Use Case Examples
Use Case Examples
  • Remote call invoking an Apex class
    const params = {
    	input: this.omniJsonDataS,
    	sClassName: 'SomeApexClass',
    	sMethodName: 'someApexMethod',
    	options: '{}',
    };
    
    this.omniRemoteCall(params, true).then(response => {
    	window.console.log(response, 'response');
    }).catch(error => {
    	window.console.log(error, 'error');
    });
  • Integration Procedure call
    const params = {
    	input: this.omniJsonDataStr,
    	sClassName: `${this._ns}IntegrationProcedureService`,
    	sMethodName: 'test_RemoteAction', this will need to match the VIP -> type_subtype
    	options: '{}',
    };
    
    this.omniRemoteCall(params, true).then(response => {
    	window.console.log(response, 'response');
    }).catch(error => {
    	window.console.log(error, 'error');
    });
  • Chainable Integration Procedure call passing the property chainable: true. Use chainable when an Integration Procedure exceeds the Salesforce CPU Governor limit.
    const options = {
    	chainable: true,
    };
    const params = {
    	input: this.omniJsonDataStr,
    	sClassName: `${this._ns}IntegrationProcedureService`,
    	sMethodName: 'test_RemoteAction', this will need to match the VIP -> type_subtype
    	options: JSON.stringify(options),
    };
    
    this.omniRemoteCall(params, true).then(response => {
    	window.console.log(response, 'response');
    }).catch(error => {
    	window.console.log(error, 'error');
    });
  • Queueable remote call passing the property useQueueableApexRemoting: true . For more information on how queueable works, see Queueable Apex.
    const options = {
    	input: this.omniJsonDataStr,
    	vlcClass: 'SomeApexClass',
    	vlcMethod: 'someApexMethod',
    	useQueueableApexRemoting: true,
    };
    const params = {
    	input: this.omniJsonDataStr,
    	sClassName: `${this._ns}VFActionFunctionController.VFActionFunctionControllerOpen`,
    	sMethodName: 'runActionFunction',
    	options: JSON.stringify(options),
    };
    
    this.omniRemoteCall(params, true).then(response => {
    	window.console.log(response, 'response');
    }).catch(error => {
    	window.console.log(error, 'error');
    });
  • Future remote call passing the property useFuture: true. For more information on how Future Methods work, see Future Methods.
    const options = {
    	useFuture: true,
    };
    const params = {
    	input: this.omniJsonDataStr,
    	sClassName: 'SomeApexClass',
    	sMethodName: 'someApexMethod',
    	options: JSON.stringify(options),
    };
    
    this.omniRemoteCall(params, true).then(response => {
    	window.console.log(response, 'response');
    }).catch(error => {
    	window.console.log(error, 'error');
    });
  • Continuation remote call passing the parameter useContinuation: true. For more information on how continuation works, see Continuation Class.
    const options = {
    	input: this.omniJsonDataStr,
    	vlcClass: 'SomeApexClass',
    	vlcMethod: 'someApexMethod',
    	useContinuation: true,
    };
    const params = {
    	input: this.omniJsonDataStr,
    	sClassName: 'SomeApexClass',
    	sMethodName: 'someApexMethod',
    	options: JSON.stringify(options),
    };
    
    this.omniRemoteCall(params, true).then(response => {
    	window.console.log(response, 'response');
    }).catch(error => {
    	window.console.log(error, 'error');
    });