Events Example

This workflow model demonstrates how you can use events in various ways. This workflow model is provided as a kind of reference for how handlers can be set up. It isn't intended to be particularly useful or functional beyond its purpose as a demonstration.

{
    "id": "events",
    "title": "Events Example Model",
    "nodes": {
        "start": {
            "type": "start",
            "transitions": {
                "start": "node1"
            }
        },
        "node1": {
            "type": "participant",
            "title": "Step One",
            "description": "Step One Description",
            "swimlane": "main",
            "transitions": {
                "approve": "end"
            },
            "handlers": {
                "LEAVE": [{
                    "type": "script",
                    "config": {
                        "script": "for (var i = 0; i < documents.length; i++) { documents[i].properties.state = 'approved'; }"
                    }
                }, {
                    "type": "setProperties",
                    "config": {
                        "properties": [{
                            "name": "state",
                            "value": "approved"
                        }]
                    }
                }, {
                    "type": "removeProperties",
                    "config": {
                    "properties": [{
                        "name": "state"
                    }]
                }, {
                    "type": "moveNode",
                    "config": {
                        "targetOffsetPath": "/Approved"
                    }
                }, {
                    "type": "syncNode",
                    "config": {
                        "asynchronous": true,
                        "targetBranchId": "master",
                        "includeAllAssociations": true
                    }
                }, {
                    "type": "webhook",
                    "config": {
                        "url": "http://localhost:8080/webhook"
                    }
                }, {
                    "type": "email",
                    "config": {
                        "to": "me@mycompany.com",
                        "body": "Hello!  You have received something to work on!",
                        "subject": "Behold something to do!",
                        "attachments": true
                    }
                }]
            }
        },
        "end": {
            "type": "end"
        }
    },
    "swimlanes": {
        "main": {
            "principals": []
        }
    }
}