Trigger event
Within Code actions, you can trigger events just like you would using the UI.
async payload => {
trigger('EVENT_NAME')
}
This allows you to move static content away from your code and trigger flows based on more complex business rules or logic.
async payload => {
toolbelt.takeover()
if(await toolbelt.isBusinessHours({ label: "livechat" })) {
trigger('TAKEOVER_OFFICE_HOURS')
} else{
trigger('TAKEOVER_OUT_OF_OFFICE')
}
}
The example above is a piece of Cloud Code that will trigger two different flows depending on the current time.
Updated 12 months ago