CCRZ.RemoteInvocation.invokeCtx

Invokes a remote action method for the current ccrz.cc_RemoteActionContext and other parameters.

Compatibility

This reference applies to:

Release Managed Package Version API Version
B2B Commerce for Visualforce Winter ’21 4.13 12
B2B Commerce for Visualforce Spring ’20 4.12 11
B2B Commerce for Visualforce Summer ’19 4.11 10
B2B Commerce for Visualforce Spring ’19 4.10 9
B2B Commerce for Visualforce Summer ’18 4.9 8

Example

Subscriber code defines an object, customRemoteInvocation, that:

  • Extends CCRZ.RemoteInvocation
  • Defines a method, exampleFunction, that:
    • Calls invokeCtx() for wrapping the remote action method, exampleRemoteActionMethod.
    • Sets the buffer parameter to false, which indicates that the remote action executes by itself.
    • Sets the nmsp parameter to false, which indicates that the remote action method is subscriber code from outside of the ccrz namespace.
CCRZ.subsc.customRemoteInvocation = _.extend(CCRZ.RemoteInvocation, {
    className: 'remoteActionApexClass',
    exampleFunction: function(exampleInputString) {
        this.invokeCtx('exampleRemoteActionMethod', exampleInputString, function(result, event) {
            if(event.status) {
                if(result && result.success) {
                    // Execute logic when the result is successful
                } else {
                    // Handle an unsuccessful result
                } 
            } else {
                // Handle a default remote action failure
            }
        },
        {
            buffer: false
            nmsp: false
        });
    }
});