This trigger is triggered after a status change. The process may involve a single object, or several of the same type. The process selection constant is ProcessID.STATUS_CHANGE
.
Detect a mass change
Just test the size of ProcessContext.getObjects()
: if it is greather than 1, the process is a mass process.
Additional parameters
When the status change is performed by service call, the additional parameter is:
action
, the call parameter representing the workflow action to be appliedor
id
, the ID of status if the workflow is configured in "by id" mode
The value is always a string
.
Old and new objects
Old object is the instance in the state before modification and new object is the instance in the state after modification.
The state modified
of the object is true
if the status has been changed (false if the instance was already in target state).
Only one property is modified: status
.
Errors
Of course, some objects may be in error. They are usually:
object not found (the object does not exist, or could not be loaded)
status not found (the target action or status does not exist)
action not applicable (the object is not in a state compatible with the action)
trigger errors, validation, security, etc.