Workflow activity reference
Every step type in the workflow designer: what it does, whether it waits, its outcomes and its settings.
This page lists the step types you can place in a workflow, with the settings of each. The designer calls them steps. The records are workflow activities. Use this page while you build a workflow. The ideas behind steps are in Workflow concepts.
Step types
| Step | Waits | Outcomes | Purpose |
|---|---|---|---|
| Comment | No | None | A note on the diagram. Nothing leads to or from it, and it never runs. |
| User action | Yes, for a user | One per transition you add | Sets a status and offers the user actions on the form. |
| Approval | Yes, for approvers | Approve, Reject | Asks users for approval and holds the record until they respond. |
| Complete | No | None | Ends the workflow. |
| Failure | No | None | Ends the workflow as failed. |
| Subflow | Not itself | One per Subflow Return | Groups steps into a diagram of their own. |
| Subflow Input | No | One | Where a subflow begins. Each subflow has exactly one. |
| Subflow Return | No | None | Leaves the subflow along the outcome with its name. |
| Scriptable | No | Success, Error | Runs a server script once and moves on. |
| Scriptable (Async) | Yes, until the script says it is done | Success, Error | Runs a server script and waits for an outside event. |
| Timer | Yes, for a time | Success, Error | Waits for a duration, a date field or a scripted date. |
| If/Else | No | True, False | Branches on a condition. |
| Switch | No | One per transition you add | Branches on the transition code a script returns. |
| Switch (Async) | Yes, until the script returns a code | One per transition you add | Branches like Switch, but waits for an outside event. |
| Run action | Yes, until the action completes | Success, Error | Runs an intelligent action. |
| No | Success, Error | Sends an email. | |
| Exception | No | Always | Runs when an error occurs anywhere in the workflow. |
In Add a step, Comment, User action, Approval, Complete, Failure, Subflow and Email are under General. Timer, If/Else, Switch, Switch (Async), Run action and Exception are under Advanced. Scriptable and Scriptable (Async) are under Scriptable. Two further definitions, a record generator activity and a simple task activity, ship inactive and are not offered.
Status and approval steps
User action
A User action sets the record’s workflow status and waits. Each transition you add appears as a button on the form. The user selects one to move the record on. In the designer, these settings are on the transition’s panel.
| Field | Type | Behaviour | Purpose |
|---|---|---|---|
| Name | Text | Required. Shown on the form. | The action name the user sees. |
| Code | Text | Required. Set when you name the transition. | Identifies the transition in permissions, scripts and Switch answers. |
| Order | Number | Higher numbers place the button further right on the form. | Orders the actions. |
| Before the transition | Script | Runs in the browser before the transition. Must end with return true; to let the form checks finish. |
Checks the record before it moves, for example that a field is filled. |
| Condition | Script | Decides whether the action is offered to the user. | Hides actions that do not apply. |
| Execute on client | Yes or no | Runs the condition in the browser instead of on the server. | Conditions that read the form. |
| After it succeeds | Script | Runs in the browser after the transition succeeds. | Follow-up logic. |
| Roles that can use it | List of roles | Only users with one of the roles see the action. The server refuses the move for anyone else. | Restricts who can move the record. |
| Button group | Text | Transitions and table operations with the same key show as one split button. | Keeps a long row of buttons short. |
| Button icon | Icon | Shown on the form button. | Makes the action easier to spot. |
Complete
A Complete step sets its status and ends the workflow. It has no outcomes. Use one for each way the work can end, such as Closed or Cancelled.
Failure
A Failure step ends the workflow as failed. The workflow instance’s status is set to failed instead of complete. Use one for each way the work can fail, such as Rejected or Abandoned.
Approval
An Approval creates an approval task for each approver and holds the record until the requirement is met. The Approve or Reject outcome then runs. An approver who decides in Self-Service moves the record through the same workflow.
| Field | Type | Behaviour | Purpose |
|---|---|---|---|
| Approval requirement | Choice | All approvals required, One approval required, At least one approval per group, Percentage of approvals required or Scripted. | How many approvals the record needs. |
| Percentage required | Decimal | Used with Percentage of approvals required. The approval is rejected as soon as the share can no longer be reached. | The share of approvers who must approve. |
| Approval requirement script | Script | Shown when the requirement is Scripted. Set answer to true to approve or false to reject. |
Requirements the other options cannot express. |
| Complete on first rejection | Yes or no | Shown for One approval required and Percentage of approvals required. | Moves on at the first rejection. |
| Force Comment | Yes or no | Approvers must enter a comment to approve or reject. | Records the reason for each decision. |
| Assignees | Users | Each user gets an approval task. | Fixed approvers. |
| Groups | Groups | Each member gets an approval task. With At least one approval per group, each group must approve once. | Approval by team. |
| Dynamic approver source | Field path | A path from the record to a field that holds a user, a list of users or a group, such as Approver on Work. | Approvers chosen on the record. |
| Advanced approval | Yes or no | Shows Business logic. | Approvers that depend on the record. |
| Business logic | Script | Returns user records from a query. See the examples below. | Scripted approvers, such as the requester’s manager. |
| Approve if no assignees | Yes or no | With no approvers found, approves if on and rejects if off. | Avoids records stuck at an approval with nobody to ask. |
| Subject | Text | Shown on forms and notifications. | Names the approval, for example “CAB approval”. |
| Instructions | Text | Shown on forms and notifications. | Tells approvers what to check. |
| Require Identity Verification | Yes or no | Approvers verify with a passkey or one-time password before they decide. | Protects sensitive approvals. |
With Require Identity Verification on, decisions from email, chat buttons and AI assistants are refused for that approval. The setting takes effect when you publish the workflow.
This Business logic script asks the members of a group whose ID is held in an application property:
let approverArr = Table("Group")
.get(ApplicationPropertyManager.getProperty("change.approval.cab_group_id"))
.relation("Member")
.map(approver => approver.Id());
if (approverArr.length !== 0) {
Table("User").IN("id", approverArr).map(r => r);
}
This one asks the manager chosen in a catalog item question named EOManager:
if (current.questions().EOManager.hasValue()) {
Table("User").EQUAL("id", current.questions().EOManager.value()).map(r => r);
}
Script steps
Scriptable
A Scriptable step runs its Script once and moves on through Success. If the script throws an error, the record follows Error. It sets no workflow status. Use it to set fields, send a scripted notification or call an integration. You do not need current.update() to save field changes.
Scriptable (Async)
A Scriptable (Async) step waits for something outside the workflow. Examples are an integration reply or the closure of subtasks. It sets a workflow status so the record shows that it is waiting.
| Field | Type | Behaviour | Purpose |
|---|---|---|---|
| Initialization script | Script | Runs once when the activity starts. | Starts the work, for example raises subtasks or calls an integration. |
| Evaluate script on start | Yes or no | Runs Script straight after the initialization script. | Moves on at once if the work is already done. |
| Script | Script | Runs each time the activity is evaluated. Return true to move on. Return ActivityOptions.DELAY_EVALUATION, false or nothing to keep waiting. |
Decides whether the wait is over. |
Something must make the workflow evaluate again. The table property workflow.trigger.parent.field does this for related records. Set it on the child table to the relationship that points at the parent, or to a comma-separated list. For example, the value ParentHRCase on HRCaseTask re-evaluates the parent HR case’s workflow whenever one of its tasks is updated.
Script variables
Workflow scripts receive these variables.
| Variable | Type | Purpose |
|---|---|---|
current |
Table record | The record the workflow runs for. |
context |
Object | State kept with the workflow between activities. |
log |
Logger | Writes to the workflow history log. |
action |
Object | The action that caused the evaluation. |
ActivityOptions |
Constants | Holds DELAY_EVALUATION for asynchronous activities. |
Branching steps
If/Else
An If/Else step tests the record against its If Else Condition. It follows True if the record matches and False if it does not.
Switch
A Switch runs its Script and follows the transition whose Code the script returns in answer. Add one transition for each path from the step’s add port, as on a User action. A Switch sets no workflow status.
The script can read current and, for records submitted from the catalog, the answers in current.questions().
Switch (Async)
A Switch (Async) has an Initialization script and a Script, like Scriptable (Async). It waits until the script returns a transition code, then follows that transition.
Other steps
Timer
A Timer waits, then follows Success. Set Timer type to one of these values.
| Field | Type | Behaviour | Purpose |
|---|---|---|---|
| Fixed duration | Timer type | Waits for Duration. | A set delay, such as a wait before automatic closure. |
| Related field | Timer type | Waits until the date in Related field. Follows Error if the field is empty. Moves on at once if the date has passed. | A date held on the record. |
| Script | Timer type | Waits until the date the script returns in answer. |
A calculated date, such as a catalog answer. |
A short fixed timer at the start of a workflow lets the record finish being created before an approval starts.
An Email step sends one email and moves on.
| Field | Type | Behaviour | Purpose |
|---|---|---|---|
| Subject | Text | Sent as the email subject. | Says what the email is about. |
| Body | HTML | Sent as the message. | The email content. |
| To, Cc, Bcc | Users | Used when Advance is off. | Fixed recipients. |
| Advance | Yes or no | Switches to the Recipients script. | Recipients that depend on the record. |
| Recipients | Script | Returns the To, Cc and Bcc addresses. | Scripted recipients. |
| Messaging account | Messaging account | Uses the active default SMTP account when empty. | The account the email is sent from. |
Run action
A Run action step queues the intelligent action named in Action and waits for it to finish. It follows Success or Error according to the action result. See Intelligent actions.
Comment and Exception
A Comment places a note on the diagram and never runs. An Exception step runs when an error occurs during workflow processing. Link its Always outcome to the step that should handle the error. Servicely looks for an Exception step at the failing step’s level first. Then it tries each enclosing level, up to the top.