ccrz.cc_RemoteActionResult

Returns the result of an Apex remote action.

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

Properties

This class defines the following Apex global properties. For more information about Apex properties and accessors, see Apex Properties.

data {get; set;}
Object that represents the result of the remote action to return to the user interface. You can serialize the object as JSON data.
inputContext {get; set;}
ccrz.cc_RemoteActionContext for initializing ccrz.cc_CallContext within the remote action.

This value is just an echo of the data passed in, and doesn't define any other functionality.

Note

messages {get; set;}
List<ccrz.cc_bean_Message> that contains error messages to return to the user interface. This list is final within the class.
success {get; set;}
Boolean
Value Usage
true The remote action completed successfully.
false The remote action encountered errors.

Constructors

This class defines a single constructor, ccrz.cc_RemoteActionResult, which doesn't take any parameters.

The constructor creates a new ccrz.cc_RemoteActionResult with the following fields:

  • success is true
  • data is false
  • inputContext is ccrz.cc_RemoteActionContext

Example

@RemoteAction
    global static ccrz.cc_RemoteActionResult customRemoteActionMethod(final ccrz.cc_RemoteActionContext ctx, other parameters) {
        ccrz.cc_RemoteActionResult result = ccrz.cc_CallContext.init(ctx);

        try {
            // Your custom business logic
            result.data = result of business logic; //data to return
            result.success = true;
        } catch (Exception e) {
            // Error handling, perhaps using result.messages to return error data
        }
        return res;
    }