Skip to main content
Version: 1.21.3

Workflow Activities

The Workflow supports a set of activities of various types to configure a process that fits your needs.

Find more about the functionality in the Workflow Editor.

note

This article describes out-of-the-box activities. To learn how to create your own workflow activities, see the Custom Activities article.

Available activities:

  • Run Script activity
  • Join activity
  • Set Values activity
  • Record Generator activity
  • Create Event activity
  • Wait Condition activity
  • If activity
  • Switch activity
  • User-approval activity
  • Subflow activity
  • Timer activity

note

To define variables in your activities via the agent interface, if necessary, complete the steps below:

  1. Navigate to Workflow → Activities.
  2. Open the activity record you need to edit or click New to create a new activity.
  3. Fill in the fields.
  4. Click Save or Save and exit to apply the changes.

See Create Workflows article to learn more.

Activity states

The activity state tells the workflow engine what to do with the activity. The states listed below are standard for all the types of activities implemented in SimpleOne.

Navigate to Workflow → Workflow Executing Activity to see the states of activities in published workflows.

Activities States

StateDescription
RunningThe workflow engine has started executing the activity.
WaitingThe workflow engine ignores the activity until a specific event fires. Then it continues processing.
FinishedThe activity is finished. You can see the result value of the activity.
CanceledThe activity (or the workflow containing it) is canceled.
ErrorA JavaScript error occurred. Review the Script Log (sys_log_script) for details.

Basic activities

Begin activity


This activity is initial and appears in a newly created workflow. It is a logical start of every workflow.

End activity


This activity, along with the Begin activity, is initial and appears in a newly created workflow. It is a logical conclusion of every workflow.

Utilities

The activities included in this category execute scripts, change and update records.

Run Script activity


The Run Script activity executes the defined script.

Activity fields

FieldMandatoryDescription
NameNSpecify the activity name. A good practice is to make the name descriptive for clarity.
Run scriptNSpecify the script to execute.
DescriptionNAdd a brief description of the activity.
caution

This activity type causes the update of the current target record after the execution. The activity logic is defined by the Immediately value in the When to run field within the Workflow Activity Type (wf_activity_type) table.

Also, the Immediately option and the related activity behavior allows to avoid using current.update() within the Run script to update records.

Join activity


The Join activity combines several activity exit transitions, so that they turn into one transition. This activity is useful for synchronizing several activities, so that the next activity does not start until the previous ones are finished.

In the example below, the Join activity waits for the results of processing of the If, Subflow, and Wait activities. If all three transitions from these activities lead to the Join activity, the Complete exit that leads to another activity named Insert is taken. If one of the activities bypasses the Join activity (in this case, it is the No exit of the If activity), then the Incomplete exit is taken.

warning

Never join multiple exits from an activity to a single Join activity, otherwise, the Join activity works incorrectly and never selects the Complete transition.

In the example below, both exits from the If activity lead to the Join activity. Even though the condition of the If activity is met, the Join activity selects the Incomplete exit as the No exit from the If activity is inactive.

How to use the Join activity

  1. From the left side menu, open the Utilities tab and drag the Join activity onto the canvas.
  2. Connect the exits of the activities you need to join with the Join activity.
  3. Create transitions from the Join activity exits (Complete and Incomplete) to the next activities.
FieldMandatoryDescription
NameNSpecify the activity name. A good practice is to make the name descriptive for clarity.
DescriptionNAdd a brief description for the activity.

Activity fields

ResultDescription
CompleteThis exit is taken when all joined activities have finished execution and proceeded to this activity.
IncompleteThis exit is taken when all joined activities have finished execution, but at least one of them has not proceeded to this activity that is, another path is taken to bypass the Join activity.
Example: In this case, the If activity bypasses the Join activity; therefore, the Incomplete exit is taken.

Set Values activity


The Set Values activity sets specific values to the current record. These values determine the activity behavior when the workflow freezes or ends.

caution

This activity type causes the update of the current target record after its execution. The activity logic is defined by the Immediately value in the When to run field within the Workflow Activity Type (wf_activity_type) table.

Activity fields

FieldMandatoryDescription
NameNSpecify the activity name. A good practice is to make the name descriptive for clarity.
DescriptionNAdd a brief description of the activity.
TableYA table to be affected by this activity. This field is populated automatically.
Set valuesNSelect the field to change its value when the workflow pauses or ends, and define the new value.
Click the leftmost field to open the drop-down list with the available fields. Click the rightmost field to open the drop-down list or enter the value (depending on the type of the selected field).

Record Generator activity


The Record Generator activity creates records in any table extending from the Task table.

Activity fields

FieldMandatoryDescription
NameNSpecify the activity name. A good practice is to make the name descriptive for clarity.
DescriptionNAdd a brief description of the activity.
Task typeYSelect the task type. You can make a selection from the corresponding task table.
Task values fromNSelect a source of values for the task to be created. Available options:
  • Values – values that you specify in the appropriate choice list.
  • Template – an existing template related to the selected task table.
Set valuesNSpecify an existing template related to the selected task table.
This field appears when the Task values from field value is equal to Values.
Task templateYSpecify an existing template related to the selected task table.
This field appears when the Task values from field value is equal to Template.
Wait for condition completeNSelect this checkbox to display Completion conditions. When selected, the conditions are mandatory for completing the task.
Completion conditionsYSpecify conditions for the created task. The process will proceed to the next activity only when the task meets all conditions.
The field is displayed when the Wait for condition complete checkbox is selected.
AdvancedNSelect this checkbox to specify a script to execute.
ScriptNSet values for the task in this script. Use the variable 'new_task' when setting additional values.
The script runs after the task values are set (defined in the Task template or Set values fields).
This field is displayed when the Advanced checkbox is selected.
Script example
new_task.parent_id = current.sys_id;
new_task.caller = current.getValue('caller');
caution
  • If both Completion conditions and Script are specified, then all of them must be executed successfully to proceed to the next activity.
  • Ensure that all mandatory fields are populated when using this activity; otherwise, execution of the workflow will stop.

Create Event activity


The Create Event activity puts an event from the Event Register (sys_event_register) table in a queue. Later, this event can execute specific scripts or send notifications. When the Create Event action runs, a new event record is created in the Event (sys_event) table.

See the System Events article to learn more.

Activity fields

FieldMandatoryDescription
NameNSpecify the activity name. A good practice is to make the name descriptive for clarity.
Event registerYSelect the event instance based on which the activity creates events. All the event instances (or event registers) are listed in the Event Registers (sys_event_register) table.
Param 1 ... Param 5NSpecify the event parameter. If this parameter is a string value, enclose it in quotes.
You can use the defined parameters in records related to the system event:
  • records of the Notification Rule (sys_notification_rule) table.
  • records related to the Notification Rule (sys_notification_rule) table: Notification Script (sys_notification_script) and Notification Template (sys_notification_template).
  • records of the Event Script Actions (sys_event_script_action) table.
DescriptionNAdd a brief description of the activity.

Conditions

The activities included in this category set conditions to continue the processing and define further transition of the workflow. The selected transition depends on the conditions set and the activity outcome.

Wait Condition activity


The Wait Condition activity pauses the workflow until the defined conditions are met. The activity checks if the record meets the conditions after every record update.

Activity fields

FieldMandatoryDescription
NameNSpecify the activity name. A good practice is to make the name descriptive for clarity.
DescriptionNAdd a brief description of the activity.
TableNA table to be affected by this activity. This field is populated automatically.
ConditionYDefine the conditions mandatory for proceeding with the Yes transition.
AdvancedNSelect this checkbox to specify a script to execute.
ScriptNSpecify a script that pauses the workflow at this activity until this script returns true. The result of the script execution will be added with the AND operator to the results of the Condition specified.
This field appears when the Advanced checkbox is selected.
Script example
const isUserManager =
ss.hasRole('process_manager'); // true or false
return isUserManager;
caution

If both Condition and Script are specified, then both of them must execute successfully to transition to the next activity. The workflow will stay paused until the Condition is met and the Script returns true.

If activity


This activity checks a condition to determine if a Yes or No transition should be taken.

note

If both the Condition and Advanced checkboxes are selected, then they both must be evaluated for this activity to proceed to the Yes transition; otherwise, the No transition is taken.

Activity fields

FieldMandatoryDescription
NameNSpecify the activity name. A good practice is to make the name descriptive for clarity.
DescriptionNAdd a brief description of the activity.
TableYA table to be affected by this activity. This field is populated automatically.
ConditionYSpecify a condition to meet in order to proceed with the Yes transition.
An empty condition always returns true.
AdvancedNSelect this checkbox to specify a script to execute.
ScriptNSpecify a script to execute. If the script is executed, the result of the script will be added with the AND operator to the results of the Condition specified. To proceed with the Yes transition, the script should return the true value.
This field is displayed when the Advanced checkbox is selected.
Script example
const uc = new SimpleUserCriteria();
const isUserLocal =
uc.userAcceptanceByCriteria(ss.getUserID(), '165470191717512124'); // true or false
return isUserLocal;

Switch activity


The Switch activity manages transitions by checking the field values against the defined case values (one or more). This activity works like the switch statement.

The activity checks against conditions specified in the Column field or in manually defined exits and, based on the outcome, selects the next transition.

Activity fields

FieldMandatoryDescription
TableNA table to be affected by this activity. This field is populated automatically.
NameNSpecify the activity name. A good practice is to make the name descriptive for clarity.
TypeYSelect the source of the exit options for this activity. The workflow will perform checks against these conditions. Available options:
  • Field – the exits are equal to the options of the field specified in the Column field.
  • Custom – create the set of exits with the conditions you need.
ColumnYSpecify a column containing options for the condition. These options will become exits of the activity.
This field appears when the Field option is selected in the Type field.
You can change the conditions of the exits or add new conditions by editing them.

In the example below, the Switch activity takes options from the Type field:

To create additional exits, perform the following steps:

  1. Right-click the Switch activity and select Add exit.
  2. Double-click the exit to open the exit form fields.
  3. Fill in the fields.
  4. Click Save.
  5. Repeat to add more exits if needed.

Activity exit fields

FieldMandatoryDescription
NameNThe option name. Specify the name If the Type field is set to Custom. If the Type field is set to Field, the name is taken from the Column.
TableNThe table to be affected by this activity. This field is populated automatically.
ActivityYThis field is populated automatically and contains an activity related to the exit.
DescriptionNAdd a brief description of the activity exit.
ConditionYDefine the conditions that are mandatory for the specified transition.
AdvancedNSelect this checkbox to specify a script to execute.
ScriptYAdd a script to execute. If specified, the workflow is paused at this activity until this script returns true.
This field appears when the Advanced checkbox is selected.
caution
  • If both Condition and Script are specified, then both of them must be executed successfully to proceed to the next activity. The workflow will stay paused until the Condition is met and the Script returns true.
  • In case of the Switch activity, every exit can be configured with the scripts. So the Advanced checkbox appears only when the activity has more than one exit. The checkbox appears only on the forms.

Approvals

With the User-approval activity, configure the approval processing: creating approvals, setting approval rules and conditions.

User-approval activity


The activity evaluates the result depending on the following factors:

  • the decision made by the approvers.
  • the conditions specified in the Approved When or Approval Conditions and Reject Conditions fields.
  • (optional) the conditions specified in scripts.

The activity can be completed with one of two results: Approved or Rejected.

Activity fields

FieldMandatoryDescription
NameNSpecify the activity name. A good practice is to make the name descriptive for clarity.
DescriptionNAdd a brief description of the activity. It is displayed in the activity block on the canvas.
TableYA table to be affected by this activity. This field is populated automatically.
Run сonditionsNSpecify the conditions to be met for generating approvals. If these conditions are not met, the workflow skips the activity. In this case, the Approved exit is taken.
Approval typeNSpecify the approval type to define the conditions of the activity exits. Available options:
  • Automatically – select the conditions for ending the activity in the Approved when field from a predefined set of conditions.
  • Manual – configure your conditions for the activity to end as required in the Approval conditions and Reject conditions fields.
Non-mandatory participantsNSelect this checkbox to add the participants who are not required to vote. When this checkbox is selected, the Non-mandatory Participants tab appears.

Subflows

Use the Subflow activity for complex workflows that include other processes.

Subflow activity


The Subflow activity performs an existing workflow as part of the current workflow.

Activity fields

FieldMandatoryDescription
NameNSpecify the activity name. A good practice is to make the name descriptive for clarity.
WorkflowYSelect a published workflow to be performed by the activity.
DescriptionNAdd a brief description for the activity.

When a Subflow block starts, a workflow context is created for the current record. Until the context is finished, another Subflow block with the same workflow cannot start, because only one workflow context can exist for the current record at a time.

For example, the Subflow block related to the "Request 2nd phase" workflow is configured in the main workflow. After the main workflow starts, the "Request 2nd phase" subflow starts too. The execution context of the subflow is paused. If the main workflow attempts to run the "Request 2nd phase" subflow again, the subflow is created in a canceled state.

Timers

The Timer activity pauses the workflow. This activity is useful when a process requires waiting for a certain period.

Timer activity


The Timer activity defines a period of time when the current workflow does not run. The logic is the following:

  • If the workflow context is not finished and the block following the Timer block has the Finished state – the block processing is restarted.
  • If the workflow context is not finished and the block following the Timer block has the Waiting state – the block processing is not restarted.
  • If the workflow context at the moment of running of the Timer block is finished – processing of the block following the Timer block is not started.

Activity fields

FieldMandatoryDescription
NameNSpecify the activity name. A good practice is to make the name descriptive for clarity.
DescriptionNAdd a brief description of the activity.
Timer, based onYSelect the way the timer duration is calculated. Available options:
  • A user specified duration – specify the amount of time to wait before proceeding to the next activity.
  • Script – specify a script to calculate the duration.
DurationYSpecify how long to wait before processing in days, hours, minutes and seconds to wait before proceeding to the next activity.
This field appears when the A user specified duration option is selected in the Timer, based on field.
ScriptYSpecify the script that implements the duration calculation logic. Use the SimpleOne API methods.
This field appears when the Script option is selected in the Timer, based on field.