Retrieving Multiple Records
Retrieving Multiple Records
To get multiple records from the workflow rule
result
use
result.dataSet.records
:
var result = Workflow.callMethod( 'AbSolutionsViewExamples-LogicExamples-getRecordsUsingDateRestriction', dateAssigned); this.cookbookWorkOrderGrid.setRecords(result.dataSet.records);
File: solutions/logic/ab-ex-logic-cookbook.js
The workflow rule returns a
DataSetList
object:
public DataSet getRecordsUsingDateRestriction(Date dateFrom) {
...
List<DataRecord> records = ds.getRecords();
return new DataSetList(records);
}
File: src/main/com/archibus/eventhandler/viewexamples/LogicExampleHandlers.java
If the workflow rule is not defined using class-level security, then the Java Script code uses the
Workflow.call()
method,
try {
var records =
Workflow.call('AbSolutionsViewExamples-getNextRequestAndOrder', {...});
this.requestReport.setRecord(records[0]);
this.orderReport.setRecord(records[1]);
} catch (e) {
Workflow.handleError(e);
}
The workflow rule Java code can attach records to the WFR response by calling the
EventHandlerContext.setResponse(List<DataRecord> records)
method.