JavaScript API Reference/Ab.workflow.Workflow object

handleError(result, callback)

Display standard error message if the workflow rule execution fails.

Parameters

  • result (JS object): JavaScript object that was passed to the callback function.
  • callback (String): (optional) callback function to be called after the error message dialog is closed;

Examples

Handle workflow rule error from the callback function:

function getUser() {
Workflow.runRule('AbCommonResources-getUser', {}, afterGetUser);
}

function afterGetUser(result) {
if (result.code == 'executed') {
...
} else {
Workflow.handleError(result);
}
}


Execute code to refresh a tab after an error message dialog is closed:

Workflow.handleError(result,
function() {
var tabPanel = View.panels.get('tabs');
tabPanel.refreshTab('page2');
}
);


In the controller, you can use any controller method as a callback:

Workflow.handleError(result, this.afterShowError.createDelegate(this));