Returning Output Parameters

Workflow rule services can return results to views. These results may include:

  • data records to be displayed.
  • options that control the view presentation or behavior.


Services methods can return only one output parameter as a return value of the Java method:

public void approveAction(String assignedTo, double costEstimated) {
...
boolean isApproved = ...
return isApproved;
}

JavaScript code can access the output parameters as follows:

try{
var result = Workflow.call('AbSolutionsViewExamples-LogicExamples-approveAction', assignedTo, costEstimated);
var isApproved = result.value;
} catch (e) {
Workflow.handleError(e);
}

Service methods can return following types of output parameters:

  • Simple values : JavaScript code can access these results using the result.value property:
    • int : integer value;
    • double : double-precision floating-point value;
    • boolean : boolean value;
    • java.util.Date : date value;
  • String : string value; JavaScript code can access the string using the result.message property.
  • DataRecord : contains a single database record field values; JavaScript code can access the string using the result.dataSet property, as an Ab.data.Record object.
  • DataSet : contains a list of records ( DataSetList ), or one-dimensional data set ( DataSet1D ), or two-dimensional data set ( DataSet2D ). JavaScript code can access the string using the result.dataSet property, as an Ab.data.DataSetList , Ab.data.DataSet1D , or Ab.data.DataSet2D object.
  • List : contains String values; JavaScript code can access the string using the result.jsonExpression property.
  • Map : contains String keys and String values; JavaScript code can access the string using the result.jsonExpression property.
  • JSONObject : a container for complex parameter values, possibly with nested arrays or objects; JavaScript code can access the string using the result.jsonExpression property; you will rarely need to use such a parameter.