Using a List of Records
Using a List of Records
To use a list of records in the workflow rule (for example, for bulk processing), pass the records restriction to the
Workflow.callMethod()
method:
var restriction = toJSON(this.customChart_dpGrid.getPrimaryKeysForSelectedRows()); var result = Workflow.callMethod('AbSolutionsViewExamples-LogicExamples-getWorkRequestChartData', restriction);
File: solutions/programming/chart/ab-ex-custom-chart.js
Use
getRecords()
from the workflow rule passing the records restriction to retrieve the list of records:
public DataSet1D getWorkRequestChartData(String restriction) {
...
List<DataRecord> records = ds.getRecords(restriction);
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, passing the records list as a parameter:
var records = this.requestGrid.getSelectedPrimaryKeyRecords();
try {
Workflow.call('AbSolutionsViewExamples-approveSelectedRequests', records);
} catch (e) {
Workflow.handleError(e);
}
The workflow rule Java code can obtain the
List
of
DataRecord
objects by calling the
DataSource.getRecordsFromContext('records')
method.
Delete Multiple Records
Send records in JSON format to the AbCommonResources-deleteDataRecords workflow rule:
var selectedRecords =
this.recurringCostGrid.getPrimaryKeysForSelectedRows();
Workflow.call
('
AbCommonResources-deleteDataRecords
', {
records: toJSON(selectedRecords),
viewName: 'ab-rplm-cost-mgmt-costs-recurring.axvw',
dataSourceId: 'dsRecurringCost'
});
File: rplm/costs/common/ab-rplm-cost-mgmt-costs-recurring.js