A published logic block does nothing on its own. An automation is only useful if it runs at the right moment: when an instance takes a path, when a user clicks a button, every night at the same time, or when a work plan starts.
With this in mind, HEFLO lets you connect each logic block to the place where it must run, and follow what it did each time it ran.
HEFLO lets users:
- Run a logic block when an instance goes through a sequence flow
- Run it when a user clicks a form button or changes a field
- Add it as a command to a task list, for the items the user ticks
- Schedule it, or run it right away
- Follow each run, step by step
- Run it when a work plan or one of its tasks starts or finishes
In this article, we explain how to connect a logic block in each of these places and how to follow its runs. To create the logic block itself, see “Create and publish a logic block”.
1. Run a logic block when a sequence flow is taken
You’ll need:
- A published logic block with the Sequence flow (on execute) surface.
- A process marked Automated Process, as explained in “How to automate a business process”.
- Open the process in the process editor and select the sequence flow.
- In Properties, open EXECUTION and click Execution.
- In Type of customization, choose Logic Blocks.
- In Logic Blocks, choose the logic block. Only Sequence flow logic blocks are listed, and one that has never been published is marked (no published version).
- Click Confirm.
- Click Save on Cloud to save the diagram.
- Publish the process again.
From now on, every instance that goes through this sequence flow runs the published revision of the logic block.
⚠️ Important — Changing the execution of a sequence flow invalidates the published version of the process. Until you publish the process again, new instances don’t run the logic block.
To disconnect the logic block, click the trash icon next to Execution and confirm.
2. Run a logic block from a form button
You’ll need:
- A published logic block with the Form event surface, whose Applies to matches the form, for example Instance of a process.
- In the process editor, select the data object of the form and click Configure Form.
- Hover over the button of the form and click the pencil (More options).
- In Action, choose Logic Blocks, then click the Logic Blocks button that appears below.
- In Configuration of Event Trigger, choose the logic block in Logic Blocks.
- Click Confirm, then Confirm in the form, then Save on Cloud.
When a user clicks the button, the logic block asks for its parameters, if it has any, shows the question of a User choice step, if it has one, and runs. An error appears as a message on the screen.
3. Run a logic block when a form field changes
You’ll need:
- A published Form event logic block, as for a button.
- In the form, hover over the field and click the pencil (More options).
- Click Change.
- In Type of customization, choose Logic Blocks and choose the logic block.
- Click Confirm, then Confirm in the form, then Save on Cloud.
The logic block runs each time the user changes the field. Since nobody is asked anything, its parameters take their Default values.
💡 Good to know — A Form event logic block runs in the user’s browser, so its runs aren’t listed in Executions. A button can only supply Text, Number, Yes or no and Date parameters.
4. Run a logic block from a task list
You’ll need:
- A published Command logic block whose How this script runs is From a task list, on the items ticked.
- Permission to edit the page that holds the task list.
- Open the page that holds the task list and switch it to edit mode.
- Hover over the task list and click its edit icon.
- In Set up Widget, open the Commands tab and click +.
- In Command, enter the Label of the command.
- In Type of customization, choose Logic Blocks, then choose the logic block in Logic Blocks.
- For each parameter, choose the Origin: Fixed value, then type the value, or Ask the user.
- Click Confirm, then Confirm in Set up Widget, and save the page.
The command appears on the task list. The user ticks one or more items and runs it. The logic block asks once for the Ask the user parameters, then runs once per ticked item. A message reports how many items were completed and which ones failed.
Only published Command logic blocks that run From a task list, on the items ticked are listed. These logic blocks can’t be scheduled.
5. Schedule a logic block
You’ll need:
- A published Command logic block whose How this script runs is On a schedule, on the items it finds itself. Such a logic block finds its own records, usually with a Load instances step, as explained in “Build the steps of a logic block”.
- In the library, click the calendar icon of the row (Schedule).
- Keep Enabled ticked.
- Set Every and Unit (hours, days, weeks, months or years). The interval can’t be longer than a year.
- Set the Hour and Minute, in the project’s time zone.
- If you like, set Starts and Ends.
- In Author of the run, click Select and choose the account the runs are recorded under.
- If the logic block has parameters, fill in their values.
- Click Confirm.
The row in the library shows the schedule, for example Every 1 days · on, and the date of the Next run.
💡 Good to know — A scheduled run is recorded under the Author of the run, but it doesn’t use that person’s permissions. A schedule can only supply Text, Number, Yes or no and Date parameters.
6. Run a logic block right now
- In the library, click the play icon of the row (Run now).
- If the logic block has parameters, fill them in.
A window shows Completed in N steps., or the error, followed by the lines the logic block wrote to the log. Click Executions to see the run in the list.
7. Follow the runs of a logic block
- In the library, open the Executions tab, or click the history icon of a row (Executions).
- Set From and To and click Search. By default, the list covers the last 7 days; a period can cover at most 31 days.
- Click the icon at the end of a row (Details).
- Click Open the script.
Each run shows its status, logic block, trigger, author, start, duration and number of steps, and its details list every step it went through. Open the script opens the revision that ran, with the date of the run in the header: each step the run went through has a green check, and a step where it failed has a red !.
The Trigger column says what started the run: Manual for Run now, Schedule, Command for a task list, or Skill. Only Command logic blocks are listed in Executions.
8. Run a logic block when a work plan event happens
You’ll need:
- The Work Plan extension installed.
- A published logic block with the Work plan event surface.
- In the process, a data object whose Data object kind is Work Plan, saved in the diagram.
- In the process editor, select the work plan data object.
- In Properties, open EXECUTION.
- Click the event: Plan started, Plan finished, Task started or Task finished.
- In Type of customization, choose Logic Blocks and choose the logic block. Only Work plan event logic blocks are listed.
- Click Confirm, then save the diagram.
The logic block runs each time the event happens on a work plan of this process.
A work plan and a work plan template also have an Automations button. There, you choose the Event and, for task events, the Task or Every task, then add the logic block. Each automation has a switch to turn it off.
9. Good to know
- A logic block runs either from a task list or on a schedule. A logic block that runs From a task list, on the items ticked can’t be scheduled, and a scheduled one can’t be put on a task list.
- Each place lists only its own surface. A logic block can’t be connected where another surface is expected.
- User parameters can’t be supplied automatically. A schedule, a button or a task list command can’t supply a User parameter.
- Form runs aren’t recorded. They don’t appear in Executions.
- A logic block run from a form has limits. It stops after 1,000 steps, or when function calls are nested more than five levels deep.
10. Common questions
A logic block is missing from the list where I connect it.
Check its surface and whether it is archived. For a form, check that its Applies to matches the form. For a task list, the logic block must run From a task list, on the items ticked.
A logic block is listed as “(no published version)”.
It has never been published, so it doesn’t run. Open it and publish it.
A sequence flow doesn’t run its new logic block.
Publish the process again: the change invalidated its published version.
I can’t find the runs of a form logic block in Executions.
That’s normal: only Command logic blocks are listed there.
The schedule reads “Suspended by the platform”.
The platform stopped the schedule and says why. Fix the cause, then save the schedule again to restart it.
A logic block run from a form stops with “Step limit exceeded” or “Call depth exceeded”.
It went past 1,000 steps or past five levels of nested function calls. Simplify the loop or the chain of calls.
Conclusion
A logic block runs exactly where you connect it:
- On a sequence flow, for every instance that goes through it
- On a form button or a field change, for the user filling in the form
- On a task list or on a schedule, for Command logic blocks
- On the start or end of a work plan or of its tasks
The key point: after connecting a logic block to a sequence flow, publish the process again. Until you do, new instances don’t run it.