Calling Workflow Rules
Calling Workflow Rules
Custom workflow rules allow you to implement application-specific business logic, such as modifying data values before save, saving multiple records to different tables as a single transaction, or sending email notifications after save. You can still use the
DataRecord
object to send or receive data to/from custom workflow rules.
If the workflow rule is defined using class-level security, use
callMethod()
from JavaScript, passing the
primaryActivity-workflowRuleName-methodName
followed by one or more arguments:
try {
var woId = this.cookbookWorkOrderConsole.getFieldValue('wo.wo_id');
var result = Workflow.callMethod(
'AbSolutionsViewExamples-LogicExamples-getRecordByPrimaryKey', woId);
...
} catch (e) {
// handle error: display an error message etc.
Workflow.handleError(e);
}
File:
solutions/logic/ab-ex-logic-cookbook.js
The workflow rule method includes the parameter(s) in the method declaration:
public DataRecord getRecordByPrimaryKey(String woId) {
...
}
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:
result = Workflow.call(" AbHelpDesk-helpDeskApprove ", parameters);
To call workflow rules directly from the AXVW using the
workflowRule
command,
Call a workflow rule from the view
For further topics discussing Workflow Rule Invocation,