Home > Scripting

State Machine - Handle

Within any of the scripts within your workflow, you can send an event to a State Machine. For this example, we have a State Machine with a Key of mystatemachine. That State Machine will have an event called event1 defined. To cause the State Machine to handle that event, you can use the following script:

// Handle an event without a parameter
function onXXXXX(value) {
    StateMachines.mystatemachine.handle('event1');
}

-or-

// Pass a parameter with the event handler.
function onXXXXX(value) {
    StateMachines.mystatemachine.handle('event1',value);
}