Loading

Task Activities

From ServiceNow Wiki
Home > Administer > Workflow > Workflow Activities > Task Activities
Jump to: navigation, search
Workflow
Related Topics
Knowledge.gif Get the Book

1 Overview

Task activities create and modify tasks. Note that these activities are only available when the workflow is defined to run on a table which extends Task.

2 Add Worknote

The Add Worknote activity adds text to the Worknotes field of the current incident record. A workflow must run on the Incident table to use this activity.

2.1 Input Variables

Field Description
Work note The text to add to the incident record.

3 Attachment Note

The Attachment Note activity adds a comment to a journal field containing a link that points towards an attachment. Attachments added to a record from this activity do not appear at the top of a record, but open a URL containing the content. This activity allows the use of irregular HTML tags to reference attachments, specifically the [code] tag. Entries in a journal field that use irregular HTML do not work if the glide.ui.allow_deep_html_validation property is true (It is set to false by default).

3.1 Results

  • Finished: the activity added the attachment to the record.

3.2 Input Variables

The following variables determine the behavior of the activity:

Field Description
Field A journal field to note the attachment. Options are:
  • none (defaults to Work Notes)
  • Additional Comments
  • Work Notes
Attachment Name The name of the attachment in the URL. In versions at Calgary or later, this name appears on the attachment at the top of the form.
Attachment Data The body of the attachment. This is the content of the attachment, formatted in a .txt file. It can be in plain text or use variables to extract specific data from a table.

4 Catalog Task

The Catalog Task activity creates a service catalog task record. A user must complete the catalog task. This activity is only available for workflows running on the Catalog Request Item [sc_req_item] table.

4.1 Results

You can assign a result value using activity.result from within a script field of the activity. The final State value of the catalog task record determines the result value for the Create Task activity. Possible result values are:

  • Closed complete
  • Closed incomplete
  • Closed skipped
  • Deleted
  • Cancelled

4.2 Input Variables

The following variables determine the behavior of the activity:

Field Description
Priority The Priority that is assigned to the task.
Wait for completion If checked, the workflow activity waits for the task to complete before continuing. If not checked, the task is created but the workflow proceeds.
Due date based on The due date fields are used to determine the values to use for setting Expected Start Time and Due Date for the task. The type determines how the due date is computed:
  • 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 The user specified duration when the type is A user specified duration.
Relative duration The relative duration when the type is A relative duration.
Due date field The date/time or duration field when the type is A date/time or duration field.
Due date script The script that sets 'answer' to the number of seconds for the duration.
Schedule based on Where to draw a schedule from to be used when calculating the duration using one of the following options. If a schedule is provided, the duration will only be considered for times that are specified on the schedule. For instance, if the duration is 2 hours and begins at 4:00pm on a schedule that is 8am - 5pm, then the duration ends at 9:00am the next day.

Options are:

  • A specified schedule
  • A schedule field
Schedule The specific schedule to use (when Schedule based on is A specific schedule)
Schedule field The field in current that identifies the schedule to use (when Schedule based on is A schedule field)
Time zone based on Where to draw the time zone from to calculating the duration. The time zone may be based on:
  • A specific time zone
  • A time zone field
Time zone The specific time zone to use when Time zone based on is A specific time zone.
Time zone field The field in the current task that identifies the time zone to use when Time zone based on is A time zone field.
Task value from The values used to create the task may either come from:
  • Fields - a predefined set of fields including Fulfillment group, Assigned to, Short description and Instructions
  • Template - an existing template for the selected task table
  • Values - values that you specify using a Set Values widget
Fulfillment group The group that is responsible for completing the task.
Assigned to The user that is responsible for completing the task.
Short description A short description for the task.
Instructions Any task instructions these are written to the task Description field.
Advanced If checked, the Advanced script is called to allow for additional task values to be set.
Advanced Script Set additional values for the task in this script. Use the variable 'task' when setting additional values. This script is run after the task values are set using the Fields, Template or Values you have specified. For example:

task.short_description = current.short_description;

Variables on Task Form A slush-bucket of optional Catalog variables to include. The variables here are displayed in the Catalog Task form in a field called Variable Editor. If no variables are defined in the field on the Catalog Task activity, the Variable Editor field in the Catalog Task form is not visible.

4.3 States

The activity state tells the workflow engine what to do with the activity. Possible state values are:

State Description
Executing The workflow engine knows to start the onExecute function of the activity.
Waiting The workflow engine ignores the activity until a specific event to restart the activity is fired.
Finished The activity finished running. See the result value for the outcome of the activity.
Cancelled This activity, or the workflow that contains this activty, was cancelled.
Error A JavaScript error occured. Review the logs for error details.

5 Create Task

The Create Task activity generates a record on any of the tables that extend Task [task].

5.1 Results

You can assign a result value using activity.result from within a script field of the activity. By default, the final State value of the task record determines the result value for the Create Task activity. Possible result values are:

  • Closed complete
  • Closed incomplete
  • Closed skipped
  • Deleted
  • Cancelled

5.2 Input Variables

The following variables determine the behavior of the activity:

Field Description
Task type The type of task to create. Select from any Task Table.
Priority The Priority that is assigned to the task.
Wait for completion If checked, the workflow activity waits for the task to complete before continuing. If not checked, the task is created but the workflow proceeds.
Due date based on The due date fields are used to determine the values to use for setting Expected Start Time and Due Date for the task. The type determines how the due date is computed:
  • 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 The user specified duration when the type is A user specified duration.
Relative duration The relative duration when the type is A relative duration.
Due date field The date/time or duration field when the type is A date/time or duration field.
Due date script The script that sets 'answer' to the number of seconds for the duration.
Schedule based on Where to draw a schedule from to be used when calculating the duration using one of the following options. If a schedule is provided, the duration will only be considered for times that are specified on the schedule. For instance, if the duration is 2 hours and begins at 4:00pm on a schedule that is 8am - 5pm, then the duration ends at 9:00am the next day.

Options are:

  • A specified schedule
  • A schedule field
Schedule The specific schedule to use (when Schedule based on is A specific schedule)
Schedule field The field in current that identifies the schedule to use (when Schedule based on is A schedule field)
Time zone based on Where to draw the time zone from to calculating the duration. The time zone may be based on:
  • A specific time zone
  • A time zone field
Time zone The specific time zone to use when Time zone based on is A specific time zone.
Time zone field The field in the current task that identifies the time zone to use when Time zone based on is A time zone field.
Task values from The values used to create the task may either come from:
  • Fields - a predefined set of fields including Fulfillment group, Assigned to, Short description and Instructions
  • Template - an existing template for the selected task table
  • Values - values that you specify using a Set Values widget
Fulfillment group The group that is responsible for completing the task.
Assigned to The user that is responsible for completing the task. See Workflow Assignments for more information on using a workflow to assign tasks.
Short description A short description for the task.
Instructions Any task instructions these are written to the task Description field.
Task template A template that is used to fill in values for the task.
Set values A widget that is used to specify values for any fields of the task.
Advanced If checked, the Advanced script is called to allow for additional task values to be set.
Advanced Script Set additional values for the task in this script. Use the variable 'task' when setting additional values. This script is run after the task values are set using the Fields, Template or Values you have specified. For example:

task.short_description = current.short_description;

5.3 States

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

State Description
Executing The workflow engine knows to start the onExecute function of the activity.
Waiting The workflow engine ignores the activity until a specific event to restart the activity is fired.
Finished The activity finished running. See the result value for the outcome of the activity.
Cancelled This activity, or the workflow that contains this activty, was cancelled.
Error A JavaScript error occured. Review the logs for error details.
Was this article helpful?
Yes, I found what I needed
No, I need more assistance
Views
Personal tools