JavaScript Event Handlers

The following event handlers are called automatically by the connector. Workflow scripts should provide implementations of as many handlers as needed.

Event Handler Summary
dispose()
          Called when the script is about to be disposed.
handleEditorOpened(dom)
          Called when the user opens a task editor or the editor is refreshed.
handleFieldChanged(dom, fieldId, oldValues, newValues)
          Called when the value or values of a field change.
handleSingleValueChanged(dom, fieldId, oldValue, newValue)
          Convenience method, called in the common case that a field had at most one value before the change and at most one value after.
handleSubmit(dom, changedFieldIds)
          Called when the user tries to submit a task.
 

Method Detail

handleEditorOpened

handleEditorOpened(dom)
Called when the user opens a task editor or the editor is refreshed. Implementors should not assume anything about field states as the model may have been saved locally after being edited, or the task may have been edited by a client without workflow support.

Parameters:
DOM dom -

handleFieldChanged

handleFieldChanged(dom, fieldId, oldValues, newValues)
Called when the value or values of a field change.

Parameters:
DOM dom -
String fieldId -
IValue[] oldValues -
IValue[] newValues -

handleSingleValueChanged

handleSingleValueChanged(dom, fieldId, oldValue, newValue)
Convenience method, called in the common case that a field had at most one value before the change and at most one value after. Changes to fields that can take on multiple values at once should be handled by implementing handleFieldChanged(dom, fieldId, oldValues, newValues) instead.

Note: handleFieldChanged(dom, fieldId, oldValues, newValues) will also be called immediately after this method returns.

Parameters:
DOM dom -
String fieldId -
IValue oldValue -
IValue newValue -

handleSubmit

handleSubmit(dom, changedFieldIds)
Called when the user tries to submit a task. Must return true or false to indicate whether the submit is allowed to proceed.

Parameters:
DOM dom -
String[] changedFieldIds - the ids of any fields with outgoing changes, including both workflow and non-workflow fields
Returns:
true or false to indicate whether the submit is allowed to proceed

dispose

dispose()
Called when the script is about to be disposed. If there are resources that need to be freed, this method should do so.