State flow customization

  • Release version: Xanadu
  • Updated August 1, 2024
  • 3 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    Summary of State flow customization

    State flows in ServiceNow Service Management applications govern how records transition between states, enabling administrators to control the sequence, triggers, and behaviors associated with state changes. This customization allows you to add or remove states, automate or manually control transitions, limit state choices, and manage field visibility and behavior based on state changes.

    Show full answer Show less

    Key Features

    • Manual and automatic transitions: Manual transitions are triggered by UI actions based on conditions or scripts, while automatic transitions use business rules that respond to data changes in requests or tasks.
    • Custom transitions: You can define and customize the order in which request and task states change, tailoring the flow to your business process.
    • Field controls: Control visibility and behavior of specific fields during state transitions or upon reaching certain states.
    • State choice list limitation: Restrict the State field values to only valid next states during transitions, ensuring data integrity and guided workflows.
    • Event triggers: Configure state flows to trigger system events on state transitions or when records reach specific end states, enabling notifications or script actions.
    • Custom state flows and scripting: Creating custom state flows requires scripting knowledge and allows for complex transition logic and field controls.
    • Dictionary overrides: Set starting states for new records on extended tables using dictionary overrides to apply customizations selectively.
    • Work notes: Use work notes to communicate information related to state transitions, supporting transparency and auditability.
    • Rebuild and cleanup: Rebuild state flows to resolve sysid mismatches and benefit from automatic cleanup of programming elements when state flows are deleted.

    How State Flows Work

    State flows replace the default process controlling how requests and their tasks move between states by automatically generating business rules, client scripts, and UI actions. These elements enforce transitions, field controls, and event triggers specified in the state flow records. When state flows are removed, associated programming elements are also cleaned up if no longer needed.

    User Role Considerations

    Permissions are role-based: users with the wmadmin role manage work order and task flows but cannot manipulate facilities records, while users with the facilitiesadmin role manage facilities request and task flows but cannot manage work order records.

    Practical Benefits for ServiceNow Customers

    • Gain precise control over the lifecycle of requests and tasks to align workflows with your operational processes.
    • Improve data quality and user experience by restricting state transitions and field inputs to valid options.
    • Automate notifications and actions tied to state changes, reducing manual effort and response times.
    • Customize complex state transition logic with scripting capabilities to meet unique business requirements.
    • Maintain clarity and communication through work notes during state changes.
    • Ensure system integrity with built-in cleanup of obsolete automation when state flows are removed.

    State flows control the sequence in which records transition between states in Service Management applications.

    An administrator can perform the following tasks:
    • Add or delete states.
    • Trigger events on particular state transitions.
    • Transition to another state automatically when data in a request or its task changes, or change states manually when the user clicks a button.
    • Limit the choice list for the State field to those end states that are valid transitions from the given start state.
    • Control the visibility and behavior of selected fields on a target table when records in that table change states.
    • Create custom state flows. Turn off the State flows are enabled option on the configuration screen. Creating custom state flows requires scripting knowledge.
    Note:
    Users with the wm_admin role can create, read, update, and delete only work order flows and work task flows. Users with the facilities_admin role can create, read, update, and delete only facilities request flows and request task flows. Users with the wm_admin role cannot manipulate facilities records, and users with the facilities_admin role cannot manipulate work order records.

    How SM request and task state flows work

    State flows replace the standard process that controls how requests and their associated tasks move between states. The ServiceNow system creates business rules, client scripts, and UI actions that perform the transitions and field controls you specify. These programming elements remain in use while the state flow records that use them are present. When state flows on an SM application table are deleted, the system attempts to delete any unnecessary programming elements that were created on that table. You can limit the selections for the State field to valid states for the transition, based on the starting state.

    State flows provide the following controls:
    • Manual transitions:A UI action, created automatically by the system when you provide a condition or a script, initiates a transition.
    • Automatic transitions:A business rule, created automatically by the system when you provide a condition and a script, initiates a transition when changes are made to a request or task.

    Features available with state flows

    • Custom transitions: Customize the order in which states can change for requests and task records.
    • Field controls: Control the behavior and visibility of specific fields when a task changes states or reaches a specified end state.
    • State choice list:Limit the values offered in a task record State field to valid states for that transition. This is the same client script that the system creates to manage field controls for state transitions.
    • Events:Trigger events when a state transition occurs or when a record reaches a specific end state.

    Start and end states

    You can create a custom state flow for processing that must occur when a task record makes a specific transition from one state to another. These records require a starting state and an ending state, and processing occurs during the transition between states. To perform some processing when a task record reaches a particular end state, you only need to define the end state. In some cases a state flow can have a starting state only, such as when you need to perform some type of cleanup after a task is canceled. A state flow might have no starting or ending state if the processing in the record applies to more than one state transition.

    The solution is to store the business rule or client script in a state flow record and create a condition to trigger processing for any state change that requires it. An example of this in field service management is the Roll Up Changes business rule on the Work Order Task [wm_task] table. This business rule rolls up state changes that occur in tasks to the parent work order.