Control Flow
Control flow in Laminar
Control flow basics
Adding if this then that logic in Laminar can be done using either JavaScript or JQ. Here are examples in both languages:
JavaScript Example
(payload) => {
const { input } = payload;
if ((input.activity_type === "route-destination-status" ||
input.activity_type === "update-destinations") &&
/skipped|failed|completed|loaded/.test(String(input.detailed_event)) &&
input.order_id?.length > 0) {
return {
"lam.resolveThenExecute": {
"lam.workflowId": 60,
"lam.payload": input,
"lam.result": { "status": "OK" }
}
};
} else {
return { "lam.exit": true };
}
}JQ Example
Another Control Flow Example
JavaScript Version
JQ Version
Laminar Keywords
Keywords allow workflows to be executed conditionally from within flows, making it easier to support complex control flow logic within custom integrations.
Last updated
Was this helpful?