Create and publish a logic block

Many processes need small automations that react to what happens: fill in a field when an instance takes a path, ask the user a question when they click a form button, or check overdue instances every night. Until now, this kind of automation was hard to set up without technical help.

With this in mind, HEFLO offers logic blocks: automations you draw as a flowchart, step by step, and publish when they are ready. In the editor, a logic block is called a script.

HEFLO lets users:

  • Draw an automation as a flowchart, one step at a time
  • Choose where it runs: a sequence flow, a form, a task list, a schedule or a work plan
  • Ask for values when it runs, and keep working values while it runs
  • See what is missing before publishing
  • Keep a published version running while the next one is prepared
  • Archive, restore, export and import logic blocks

In this article, we explain what a logic block is, how to open the library, create a logic block, add its steps, declare its values, fix what is missing, publish it, change it later, archive it and move it to another environment.

1. What is a logic block?

A logic block is a flowchart that starts at START, goes through steps and ends at END. Each logic block is created for one Surface: the place in HEFLO that runs it. The surface decides when the logic block runs and which steps it can use.

SurfaceWhen it runsWhere you connect it
Work plan eventA work plan starts or finishes, or one of its tasks starts or finishes.A work plan data object, in the process editor.
Sequence flow (on execute)An instance goes through a sequence flow of the process.The Execution button of the sequence flow.
Form eventA user clicks a form button or changes a form field.The button action or the Change event of the field, in the form.
CommandA user runs it from a task list, or it runs on a schedule or with Run now.The task list, or the library itself.
FunctionOnly when another logic block calls it.The Call a script step of another logic block.

How to connect each surface is explained in “Choose when a logic block runs”.

2. Open the Logic Blocks library

You’ll need:

  • The Administrator role in the environment. The Process administrator role isn’t enough.
  • The Logic Blocks extension installed. In Manage Environment, its card in Extensions shows Installed.
  1. Open the process editor.
  2. Click the view button at the top of the screen. It shows the name of the current view, for example Editor.
  3. In the Visualization Mode menu, click Logic Blocks.

The Visualization Mode menu open, with Logic Blocks listed between Work Plans and Reports.

The library opens on the Logic Blocks tab, next to a second tab called Executions. Each row shows the Name, Description, Surface, Applies to, Revision and Status of a logic block. The last columns show the schedule of Command logic blocks.

The Logic Blocks library listing three scripts, two Command and one Function, all Published, with the row action icons at the right.

The icons at the end of each row are, from left to right: Open, Rename and Export. Command logic blocks also have Schedule, Run now and Executions. You can also double-click a row to open it.

3. Create a logic block

  1. In the library toolbar, click the add icon (+). The New script window opens.
  2. Enter the Name.
  3. Choose the Surface, as described in section 1.
  4. For a Form event logic block, choose in Applies to the kind of record the form belongs to, for example Instance of a process. This field is required for Form event, optional for Function, and absent for the other surfaces.
  5. If you like, enter a Description.
  6. Click Confirm.

The New script dialog with the name filled in and the Surface list open, showing Work plan event, Sequence flow (on execute), Form event, Command and Function.

⚠️ Important — The Surface and Applies to can’t be changed once the logic block is created. To move an automation to another surface, create a new logic block.

The editor opens on the new logic block, marked Draft · v1. The canvas shows START connected to END, and the panel on the right shows the Script settings. For a Command logic block, this panel also asks How this script runs.

The editor of a new Command script: START connected to END on the canvas, and the Script panel with How this script runs, Parameters and Variables.

4. Add and remove steps

  1. Click the + on the connection where the step must go. Its tooltip reads Insert step here.
  2. Choose the step in the menu. The menu lists only the steps this surface accepts.
  3. Fill in the step in the panel on the right. Every step has a Name: it is the text shown on the canvas.

The insert menu of a Command script, listing Connector call, Decision, For each (loop), Load instances, Load tasks, Start an instance, Query records, Fetch records, Set a variable, Call a script, Log line, Stop with error and Note.

The step appears between the two steps that were connected, already selected.

To remove a step, select it and click the trash icon next to the panel title (Remove step). The flow reconnects around it. START and END can’t be removed.

To undo or redo a change, use the arrows below the zoom buttons, at the bottom left of the canvas.

5. Declare parameters and variables

Click an empty area of the canvas to show the Script panel.

  • Parameters are values supplied by whoever runs the logic block: a user clicking a button, a task list command, a schedule. Click + next to Parameters and fill in Name, Type (Text, Number, Yes or no, Date or User), Label, Default and Required. Inside the logic block, a parameter is read as param.name. Only Command, Function and Form event logic blocks have parameters.
  • Variables are values the logic block writes while it runs. Click + next to Variables and fill in Variable, Type (Text or Number) and Initial value. Every surface has variables.

The Parameters section with a required Text parameter named reason, labelled Reason for approval, and the Variables section with a Number variable named total starting at 0.

Names have no spaces or dots. The Label is what a user sees when the logic block asks for the value.

💡 Good to know — In any text field of a step, type a colon (:) to pick a value from a list: parameters, variables, the item of a loop and the fields of the instance.

6. Fix what is missing

While a step is incomplete, an orange ! marks it on the canvas, and the header shows how many issues the logic block has, for example 1 issue(s).

  1. Click the issue counter in the header.
  2. Read the list: each entry names the step and says what is missing.
  3. Click an entry to select that step, then complete it.

The issue list open under the header, reading Decision 1: This path needs a business rule or must be the default path. On the canvas the Decision step carries an orange exclamation mark and a no rule chip.

When the last issue is fixed, the counter disappears from the header. A logic block with issues can be saved, but it can’t be published.

7. Save and publish a logic block

A logic block goes through three statuses: Draft while you edit it, Published when it is the revision that runs, and Retired when a newer revision has replaced it. Only one revision is published at a time.

  1. Click Save. The button is active only while there are unsaved changes.
  2. Click Publish. It stays inactive while there are unsaved changes (Save the draft before publishing) or issues (Fix the validation issues before publishing).

The badge now reads Published · v1, and Save and Publish give way to New revision. The editor becomes read-only: the + marks and the undo arrows are gone.

A published script in read-only mode: the connections have no plus marks and the Script panel fields are greyed out.

8. Change a published logic block

  1. Open the logic block.
  2. Click New revision. A draft with the next number is created as a copy of the published revision. If a draft already exists, it opens instead.
  3. Edit, save and publish the draft.

The new revision is published and the previous one becomes Retired. While the new revision is still a draft, the published one keeps running. The revision list next to the name lets you open any revision.

The revision list beside the script name, open, showing v2 · Draft and v1 · Published.

💡 Good to know — A test work item runs the latest draft of a Form event logic block. You can try a change on a form before you publish it, as explained in “How to perform process automation tests”.

9. Rename, archive or restore a logic block

Logic blocks aren’t deleted: they are archived.

  1. In the library, click the gear icon of the row (Rename).
  2. Change the Name or the Description and click Confirm. To archive instead, click Archive and answer Yes.

The Rename dialog with Name and Description, and the Archive button at the bottom left.

An archived logic block leaves the library list and no longer appears where logic blocks are chosen. To restore it, turn on Show archived, open Rename on its row and click Restore.

⚠️ Important — Archiving doesn’t stop a logic block that is already connected. Its published revision keeps running on the sequence flow, button, command or work plan it is connected to. Remove that connection first.

10. Export and import a logic block

  • Export: click the download icon of the row (Export). A file ending in .hgs.json is saved.
  • Import: click the upload icon in the library toolbar (Import script) and drop the file. The file brings the logic block, the functions it calls, the business rules its decisions use and the messages it sends. A logic block that already exists in the environment under the same code is kept as it is.

11. Good to know

  • The surface is chosen once. To change the Surface or Applies to, create a new logic block.
  • Logic blocks are archived, not deleted. You can restore them at any time.
  • A published revision is read-only. To change it, create a New revision.
  • Publishing needs a clean draft. Save your changes and fix every issue first.
  • Steps are placed automatically. You can’t drag a step or draw a connection by hand: the + is how the flow grows.
  • You can resize the panel. Drag the bar between the canvas and the panel; the width you choose is remembered.
  • The library is for administrators. It opens only with the Administrator role.

12. Common questions

Logic Blocks is missing from the Visualization Mode menu.
The extension isn’t installed, or you don’t have the Administrator role. Right after the editor opens, the menu can also appear before the list of extensions has loaded: close the menu and open it again.

The Publish button is grey.
There are unsaved changes or open issues. Hover over the button to see which, then save or fix them.

I can’t remove a Decision step.
A decision with more than one output can’t be removed in one go. Remove its outputs first, then the step.

The last icons of a row are cut off.
On a narrow window, the action icons can sit past the right edge of the list. Scroll the list sideways.

Conclusion

Logic blocks let you build your own automations without leaving HEFLO:

  • A flowchart drawn step by step, with steps suited to where it runs
  • Issues shown on the canvas before you publish
  • A published revision that keeps running while you prepare the next one
  • Logic blocks you can archive, restore, export and import

The key point: choose the surface carefully. It decides where the logic block runs and which steps it can use, and it can’t be changed later.

Was this article helpful?

Related Articles