Call Variable Method Action

The action module for this action is vb/action/builtin/callVariableMethodAction. This action is used to call a method on a variable of InstanceFactory type only. Using it with any other variable will report an error.

Here is an example.

"callGetCapabilityChain": {
  "root": "getCapabilityOnLDPV",
  "actions": {
      "getCapabilityOnLDPV": {
          "module": "vb/action/builtin/callVariableMethodAction",
          "parameters": {
            "variable": "$page.variables.incidentsListView",
            "method": "getCapability",
            "params": [
              "sort"
            ]
          }
      }
  }
}

Where incidentsListView is an InstanceFactory variable defined like this:

"incidentsListLDPV": {
    "type": "ojs/ojlistdataproviderview",
    "constructorParams": [
        "{{ $page.variables.incidentsList.instance }}",
        {
          "sortCriteria": [
            {
              "attribute": "priority",
              "direction": "ascending"
            }
          ]
        }
    ],
    "persisted": "session"
}

To call a variable method, we need to pass the following parameters:

Parameter Name Description
variable The variable path
method The name of the method to call
params (optional) An array of parameters. Note that a single parameter must still be passed as a single item array.

The outcome is either 'success' if the function call was successful, or a 'failure' outcome. An error is thrown for configuration errors.

The result payload is equivalent to whatever the function returns (which may be undefined if there is no return). If the function returns a promise, the result payload will be whatever is resolved in the promise.