ARCHIBUS Web Central

Invoking Workflow Rules

 

Calling rules from AXVW forms

If the event-handler method does not require input parameters, and does not return any data, application views can call it using a standard view command.The command must specify the workflow rule's application ID and rule ID, for example:

<action>
    <title>Approve Request</title>
    <command type="workflowRule" ruleId="AbHelpDesk-helpDeskApprove"/>
</action)


If the workflow rule is defined using class-level security, then the command must specify the workflow rule's application ID and rule ID, and the event-handler method name, for example:

<action>
    <title>Update Area Totals</title>
    <command type="workflowRule" ruleId="AbCommonResources-SpaceService-updateAreaTotals"/>
</action)


You can also use view commands to call event-handler methods that take parameters that are compatible with standard view commands:

 

Calling rules from Java Script

As discussed in the System Integration section of the documentation; you can also call workflow rules and test their return values from the Java Script Workflow object. This lets you pass arbitrary parameters to workflow rules, and also to handle workflow rules response values.

try {
    var parameters = {
        name: value,
        name: value
    };
    result = Workflow.call("AbHelpDesk-helpDeskApprove", parameters);
    ... code that uses the result goes here ...
} catch (e) {
    // handle error: display an error message etc.
    Workflow.handleError(e);
}


If the workflow rule is defined using class-level security, then the Java Script code must use the Workflow.callMethod() instead of the Workflow.call():

try {
    var costId = ...;
    var dateStart = ...;
    result = Workflow.call("AbCommonResources-CostService-createScheduledCosts", costId, dateEnd);
    ... code that uses the result goes here ...
} catch (e) {
    // handle error: display an error message etc.
    Workflow.handleError(e);
}

 

Calling event-Handler methods from other event-handler methods

Event-handler methods can be called from custom application-level event handlers. The event handlers are exposed to the application Java code through the standard Context object.

public void myHandler() {
    ...
    // get the event handler instance
    LeaseAlertHandlers handlers = (LeaseAlertHandlers) ContextStore.get().getEventHandler('LeaseAlerts');
    
    // call one of the business methods handlers.
    generateAlerts();
    ...
}