TaskStateUtil - Global

The TaskStateUtil API is in the task state management utility script include and is used for working with task-type table state attributes.

The TaskStateUtil API is primarily used by the Task Active State Management business rule to set the active field based on state changes. Configurations are defined in the task.state dictionary element, usually using dictionary overrides since state values vary by table.

The TaskStateUtil API can be called by any server script to determine inactive states, default work, or default close states for a table.

The required attributes are defined on the planned_task table so all planned task types are supported. We will eventually add the attributes to other task types and eventually the base task table. You are free to do this if you want to leverage this feature now.

These attributes can be defined on the task.state dictionary element or a dictionary override for extended task tables.
Table 1. Related Attributes
Attribute Definition
close_states Semicolon delimited list of state values that are inactive, used to identify whether the task should be set to active or inactive. This is a required attribute to use the TaskStateUtil functionality.
default_close_state Optional attribute to define the state value of the default close state if you want to define business rules that automatically close a task. Defaults to 3, typically Closed Complete if attribute is not defined.
default_work_state Optional attribute to define the state value of the default working state if you want to define business rules that automatically set a task for working. Defaults to 2, typically Work in Progress if the attribute is not defined.

See the ServiceNow Developers site for API information.