Close
Thank you for your feedback.

Approval - User workflow activity

Approval - User workflow activity

The Approval - User activity creates one or more individual user approvals.

Results

The result value is the final approval disposition. This disposition depends on the approval actions take by the approvers and the approval conditions specified in the Wait for or When Anyone Rejects fields. Possible result values are:

  • Approved
  • Rejected
  • Deleted
  • Cancelled

Input variables

Table 1. Approval - User activity input variables
FieldDescription
Approval - User When

Specify when this activity generates a user approval record.

ConditionConditions which, if met, cause the individual approval to be generated. If the conditions are not met, the approval is skipped.
Approval - User Approvers

Specify the users whose approval will be requested.

UsersThe users for the approval. Use the tree icon to select user reference fields from the current record to create approvals, such as ${assigned_to}. If no user is selected, the activity automatically sets the approval to Approved.
Note: Workflow only manages approval records generated by the Approval User activity. After starting the workflow, newly added approvals do not affect the workflow context.
GroupsGroups whose members should also receive approvals. Note that this is different than the Approval - Group activity, which creates a group approval in addition to the individual approvals. The tree icon can be used to select group reference fields from the current record to create approvals, such as ${assignment_group}.
Approval - User Condition

Specify how the activity decides to approve or reject the approval, based on the responses from individual approvers.

Wait forA choice between different approval logics to determine which individual approvals result in approval of the activity's approval. Options are:
  • Anyone to approve: Any user can approve and the first approval causes the activity to complete with a result of approved.
  • Everyone to approve: All users must approve (see below for how a rejection is handled).
  • First response from anyone: The first approval or rejection from any user causes the activity to complete.
  • Condition based on script: Each time a user approves or rejects, the Approval script is called to determine if the activity should complete.
When anyone rejects

A choice between different approval logics to determine which individual rejections result in rejection of the activity's approval. Options are:

  • Reject the approval: Immediately complete the activity with a result of rejected.
  • Wait for other responses before deciding: Wait until we get other responses before making an approval or rejection decision. This allows users to change their mind until a decision is made.

Note: Note that if Wait for is set to Anyone to approve then a single approval will cause the activity to complete with a result of approved even if one or more users reject.
Approval Column

A string field for the name of the approval field on the table the workflow is running on. The default value is approval, which is the field on the Task table.

Note: Use the field's name, not its label.
Note: If using any custom approval column fields and approval column journals, use Set Value activities in the workflow to set the custom Approval column fields.
Approval Journal Column
Approval Script

If the Wait for variable is set to Condition based on script this script is called to determine how to handle an approval or rejection. The script needs to set the variable answer to approved or rejected to indicate the approval status for this approval. When called, the following information is available:

 counts.total = total number of users that are part of this approval
                    counts.approved = # of users that approved so far
                    counts.rejected = # of users that rejected so far
                    counts.requested = # of users that are pending approval
                    counts.not_requested = # of users that are not pending approval
                    counts.not_required = # of users that approval is not required

Approval - User Schedule

Specify how workflow calculates the approval record's expected start date and due date. Once you've made a selection for 'Due date based on', and 'Schedule based on', the appropriate fields will display.

Due date based onSelect how workflow determines the task's duration, due date, and schedule.
  • A user specified duration: The duration is based on a user specified value.
  • A relative duration: The duration is calculated from a relative duration (such as End of Next Business Day).
  • A date/time or duration field: The duration is based on the value of a field on the current record.
  • Script: The duration is returned by a script.
Duration

Only appears when Due date based on is set to A user specified duration

The specific number of days and hours.
Relative duration

Only appears when Due date based on is set to A relative duration

The general number and length of business days.
Due date field

Only appears when Due date based on is set to A date/time or duration field

The date/time or duration field.
Due date script

Only appears when Due date based on is set to Script

The script that sets 'answer' to the number of seconds for the duration.
Schedule based onThe basic schedule the timer uses to count working hours. If a schedule is specified, the duration will only be considered for times that are specified on the schedule. For example, if the duration is 2 hours and the workflow begins at 4:00pm on a schedule that is 8am - 5pm, then it ends at 9:00am the next day. The options are:

  • This workflow's schedule: The schedule uses workflow context date, time, and an optional Time zone based on value.
  • A specific schedule: The schedule uses a pre-defined Schedule and an optional Time zone based on value.
  • A schedule field: The schedule uses a value from a table and an optional Time zone based on value.

Schedule

Only appears when Schedule based on is set to A specific schedule

The predefined Schedule from a list.
Schedule field

Only appears when Schedule based on is set to A schedule field.

A date and time or duration field for the schedule, that is associated with the table. Valid fields appear in blue on the Select the element from a tree dialog.
Time zone based onThe time zone for calculating the duration. The time zone may be based on:
  • No time zone: Default. Workflow uses the GMT time zone.
  • A specific time zone: A specific Time zone that you choose from a choice list.
  • A time zone field: A Time zone field to track time duration from a field on the form.
Time zone

Only appears when Time zone based on is set to A specific time zone

.
Select the time zone you want from the choice list.
Time zone field

Only appears when Time zone based on is set to A time zone field.

A date and time or duration field for the schedule, that is associated with the table. Valid fields appear in blue on the Select the element from a tree dialog.
Approval - Advanced

If desired, write a script for determining additional users to request approvals from.

AdvancedSelect this check box to write a script for determining additional users to request approvals from.
Additional approvers script

If the Advanced check box is selected, this script is called to determine any additional user approvals to be created. The script needs to set the variable answer to a comma-separated list of user ids and group ids or an array of user and group ids to add as approvers. For example:

answer = [];
       answer.push('id1');
       answer.push('id2');

Conditions

The following conditions determine which transition runs after this activity.

Table 2. Approval - User activity conditions
ConditionDescription
ApprovedThe users approved the request based on the Wait for rules.
RejectedThe users rejected the request based on the Wait for rules.
ErrorThe event or condition that generates an error.
SkippedThe event or condition that allows a skipped approval.

States

The activity state tells the workflow engine what to do with the activity.

Table 3. Approval - User activity states
StateDescription
ExecutingThe workflow engine starts the execute function of the activity.
WaitingThe workflow engine ignores the activity until a specific event to restart the activity is fired.
FinishedThe activity finished running. See the result value for the outcome of the activity.
CancelledThis activity, or the workflow that contains this activity, was canceled.
ErrorA JavaScript error occurred. Review the logs for error details.

Products > ServiceNow Platform > Workflow; Versions > Helsinki