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.

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

Available activities:

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.


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.

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.

Activity fields

FieldMandatoryDescription
NameNSpecify the activity name. A good practice is to make the name descriptive for clarity.
DescriptionNAdd a brief description for the activity.

Activity exits

ResultDescription
Complete

This exit is taken when all joined activities have finished execution and proceeded to this activity.

Incomplete

This 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.

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.
TableY

A table to be affected by this activity. This field is populated automatically.

Set valuesN

Select 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 typeY

Select the task type. You can make a selection from the corresponding task table.

Task values from

N

Select 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 valuesN

Specify an existing template related to the selected task table.

This field appears when the Task values from field value is equal to Values.

Task templateY

Specify 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 completeN

Select this checkbox to display Completion conditions. When selected, the conditions are mandatory for completing the task.

Completion conditionsY

Specify 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.
ScriptN

Set 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).

For example:

Script
new_task.parent_id = current.sys_id;
new_task.caller = current.getValue('caller');

This field is displayed when the Advanced checkbox is selected.

  • 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 registerY

Select 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 5N

Specify 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.
ScriptN

Specify 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.

Example
const isUserManager =
  ss.hasRole('process_manager'); // true or false
return isUserManager;

This field appears when the Advanced checkbox is selected.

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.

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.
ConditionY

Specify 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.
ScriptN

Specify 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.

Example
const uc = new SimpleUserCriteria();
const isUserLocal =
  uc.userAcceptanceByCriteria(ss.getUserID(), '165470191717512124'); // true or false
return isUserLocal; 

This field is displayed when the Advanced checkbox is selected.

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.

Type 

Y

Select the source of the exit options for this activity. The workflow will perform check against these conditions. Available options:

  • Field – the exits are equal to the options of the field specified in the Column field.
  • Customcreate the set of exits with the conditions you need.
ColumnY

Specify 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.

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


You can change the conditions of the exits or add new conditions by editing them.

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
NameN

The 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.
AdvancedN

Select this checkbox to specify a script to execute.

ScriptY

Add 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.

  • 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

NameMandatoryDescription
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 сonditionsN

Specify 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 typeN

Specify 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 participantsN

Select this checkbox to add the participants who are not required to vote. When this checkbox is selected, the Non-mandatory Participants tab appears.

Mandatory participants tab
EmployeesN

Select the responsible users. They will receive the approval tickets to make a decision.

GroupsN

Select the responsible groups. Users included in this group will receive the approval tickets to make a decision.

RolesN

Select the roles whose owners will receive the approval tickets to make a decision.

AdvancedNSelect this checkbox to specify a script to execute.

Mandatory participant script

N

If the Advanced checkbox is selected, this script is called to determine if any additional approvals should be created.

The script is intended to set the answer variable to a comma-separated list of user IDs to add as approvers.

The code example below implements the following logic:

  1. Checks groups of the current caller.
  2. Checks the value of the Responsible attribute of these groups.
  3. If the responsible group is found, then their user ID is added to the answer array.
Script example
const caller = current.getValue('caller');
const callerGroup = new SimpleRecord('sys_user_group');
callerGroup.addQuery('user_id', сaller);
callerGroup.selectAttributes('group_id');
callerGroup.query();
while (callerGroup.next()) {
  if (callerGroups.group_id.getValue('responsible')) {
    answer = callerGroups.group_id.getValue('responsible');
  }
}

You can pass values to the answer variable either as a string or as an array, for example:

answer = ['100000000000000001', '160017550418345219', '159974538715046822']

answer='100000000000000001,160017550418345219,159974538715046822'

This field appears when the Advanced checkbox is selected.

Approved whenN

Define the approval logic. Available choice options:

  • Anyone to approve – the Approved exit is taken if at least one responsible user approves the ticket.
  • Everyone to approve – the Approved exit is taken only if all responsible users approve the tickets; otherwise, the workflow takes the Rejected exit.
  • First response from anyone – the exit to be taken depends on the first decision received: the first user to make the decision defines the outcome.
  • Most answers – the activity outcome depends on the number of the approvals and rejections: if there are more approvals, then the Approved exit is taken and vice versa.
  • Conditions based on script – the activity outcome depends on a script that calculates the result every time it receives an approval or rejection.

This field appears when the Approval type is set to Automatically.

Approval scriptN

Provide a script to determine the approval condition. The script in the example below verifies if at least one member of each approval group has taken a positive decision. In this case, the approval result is considered positive (Approved).

Script example
(() => {
  let isFirstGroupApprove = false;
  let isSecondGroupApprove = false;

  const docID = ss.getDocIdByIds(current.sys_db_table_id, current.sys_id);

  const rejectedApp = new SimpleRecord('sys_approval');
  rejectedApp.addQuery('item', docID);
  rejectedApp.addQuery('state', 'rejected');
  rejectedApp.setLimit(1);
  rejectedApp.selectAttributes(['sys_id']);
  rejectedApp.query();
  if (rejectedApp.next()) {  // One of tickets rejected
    answer = 'rejected';
  }

  const approvedApp = new SimpleRecord('sys_approval');
  approvedApp.addQuery('item', docID);
  approvedApp.addQuery('state', 'approved');
  approvedApp.selectAttributes(['approver_id']);
  approvedApp.query();

  const uc = new SimpleUserCriteria();
  while (approvedApp.next()) {
    let approver = approvedApp.getValue('approver_id');

    if (!isFirstGroupApprove) {
      isFirstGroupApprove = uc.userAcceptanceByCriteria(approver, '167416106197358457'); // First Group Member
    }
    if (!isSecondGroupApprove) {
      isSecondGroupApprove = uc.userAcceptanceByCriteria(approver, '167416108994075219'); // Second Group Member
    }
  }

  if (isFirstGroupApprove && isSecondGroupApprove) {
    return 'approved';
  } else {
    return 'waiting';
  }
}
)()

This field appears when the Approved when field is set to Condition based on script.

Approval conditionsY

Specify the conditions to be met for the Approved exit. If there is more than one condition, they are checked one after another.

This field appears when the Approval type is set to Manual.

Reject conditionsY

Specify the conditions to be met for the Rejected exit. If there is more than one condition, they are checked one after another.

This field appears when the Approval type is set to Manual.

Non-mandatory Participants tab

This tab appears when the Non-mandatory participants checkbox is selected.
EmployeesN

Select responsible users from the Employee list. They will receive the approvals and make their decisions. Yet, their approval is not mandatory.

Groups

N

Select responsible groups. Users included in this group will receive the approvals and make their decisions. Yet, their approval is not mandatory.

Roles

N

Select roles whose owners will receive the approvals and make their decisions. Yet, their approval is not mandatory.

Advanced

NSelect this checkbox to specify a Non-mandatory participant script to execute.
Non-mandatory participant scriptN

This script is called to determine if any additional approvals to be created.

The script is intended to set the answer variable to a comma-separated list of user IDs to add as approvers.

See an example and clarifications above.

This field appears when the Advanced checkbox is selected.

Consider non-mandatory participants

N

Select this checkbox to allow non-mandatory participants to vote in approval tickets.

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.
WorkflowY

Select 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 onY

Select 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.
DurationY

Specify 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.

ScriptY

Specify 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.

Schedule tab
Timezone, based onN

Specify a timezone source for this activity. Available options:

  • (No time zone)
  • A specific time zone
TimezoneY

Select a timezone from the list.

This field appears when the Timezone, based on option is set to A specific time zone.

Schedule, based onN

Specify a schedule source for this activity. Available options:

  • (No Schedule)
  • A Specific Schedule
ScheduleY

Select a schedule from the list.

This field appears when the Timezone, based on option is set to A Specific Schedule.



  • No labels