Overview: Custom Stage Column in WorkflowIssue <!-- div.margin{ padding: 10px 40px 40px 30px; } table.tocTable{ border: 1px solid; border-color:#E0E0E0; background-color: rgb(245, 245, 245); padding-top: .6em; padding-bottom: .6em; padding-left: .9em; padding-right: .6em; } table.noteTable{ border:1px solid; border-color:#E0E0E0; background-color: rgb(245, 245, 245); width: 100%; border-spacing:2; } table.internalTable{ border:1px solid; border-color:#E0E0E0; background-color: rgb(245, 245, 245); width: 100%; border-spacing:0; } .sp td{ border-bottom: 1px solid; border-right: 1px solid; border-color:#E0E0E0; background-color: #ffffff; height: 20px; padding-top: .5em; padding-bottom: .5em; padding-left: .5em; padding-right: .5em; } .sphr td{ border-right: 1px solid; border-bottom: 1px solid; border-color:#E0E0E0; background-color: rgb(245, 245, 245); padding-top: .5em; padding-bottom: .5em; padding-left: .5em; padding-right: .5em; height: 20px; } .title { color: #D1232B; font-weight:; font-size:25px; } .hd1{ color: #D1232B; font-weight:; font-size:18px; } .hd2{ color: #646464; font-weight:bold; font-size:16px; } .hd3{ color: #7a7a7a; font-weight:; font-size:16 px; text-decoration:; } .hd4{ color: #000000; font-weight:bold; font-size:14 px; text-decoration:; } --> Overview: Custom Stage Column in Workflow Goals Learn how to add a custom stage column to a table.Learn how to have a workflow write stages to that column. Adding a custom stage column When designing applications, using the Stage column is an excellent way to reflect process progress to a user while abstracting away from the complexity of the Workflow. The Element type of Workflow, when associated with a Workflow Version will receive the stage state as the workflow executes. For this lab, a custom application named K14 has been added to your instance. Return to the main ServiceNow tab.In the Application Navigator Text filter type, K14. Select the K14 301s link. Select the New button.In the header of the form, right-click and Personalize > Form Layout.Find the Create new field section on the form. Fill out the Create new field section as follows: Name: Stage Type: Workflow Click the Add button.Use the Up Arrow to move the new Stage field just under State.Click the Save button. Right-click on the Stage label.Select Personalize Dictionary. NOTE: When adding a Stage column to a table in an application that is specific to rendering the Stage progression icons, it is best practice to make that field Read only. In this way, conflicts between the workflow process and what the user sees are not possible. The Workflow Engine writes to the Stage field, it does not read or react to it. Check Read only. Click Update. Now that there is a Workflow field that can accept Stages from a workflow, configure a workflow to write to that field. Associate stage column to stages Return to the Workflow Editor tab.Click Open.Select K14 – 301 Custom Stage Demo.Select Gear Menu > Check out.Select Gear Menu > Properties. Notice: This workflow is written against the K14_301 table just modified.The workflow runs only when the Name starts with Custom Stage. The Stage field is the field that tells the Workflow Engine to write the current Stage value to the current record. It is possible to have Stages in a workflow and not have them communicate to the current record. They can be on the workflow just for clarity when viewing the Workflow on the Canvas. However, if the designer intends to reflect the progress of the workflow in Stage icons, this field must be selected. Select the Stage column from the choice list.The stage section of your screen should look like this: Notice the two additional Stage Fields. These are fields that will determine how the Workflow Engine follows the stages through the workflow execution and how it reports them. Stage rendering The Workflow Engine determines how to render the stages in the icon list based on one of these selections. Legacy: This is the least desired selection. The legacy rendering will continue to support all the icon script includes and Business Rules that are already deployed in previous versions of the product. This is specifically for backwards compatibility. Linear: The Workflow Engine will render all the icons in the Workflow Stage list, in the order that is assigned to the individual Stages. With the Linear renderer, the Workflow Engine will maintain the Stage state even if the Stages are changing in subflows. With this selection, the designer has the most control over how the Stages will appear in the list. Every Stage will appear, regardless of whether or not the stage was executed in the Workflow. Main flow: The Workflow Engine will render only the icons that represent Stages executed in the Main flow. If there are Stages in subflows they will not reflect in this icon list. If there are stages on execution paths not executed in a workflow, they will not show in the stage icon list. Progress Bar: The Workflow Engine will not render icons as all. It will render a single progress bar that shows the overall progress of the Workflow. Workflow-Driven: This is the default selection. With this selection the Workflow Engine will initially render icons that represent Stages that are on the ‘happy path’ of execution. That is the Stages on Approved, Yes, Always, and Complete condition paths. However, if during execution an “unhappy path” begins (for example an Approval Rejection), the Workflow Engine will re-calculate and redraw the icon tree. In the adjusted rendering, the “happy path” no longer displays and the Workflow Engine attempts to predict the next likely path the workflow could transition towards. Stage order The Workflow Engine will determine the order in which stages will appear in the icon list based on one of these selections. Computed: Icons by default are ordered in the order of execution of a workflow and based on the expected or surmised future path found in all transitions. This default ordering is called the Computed order and is defined in the workflow properties under the field Stage order. User Specified: The workflow designer may determine the exact order of icon rendering in a list, regardless of execution order by selecting User Specified in the Stage order: field of workflow properties and appropriately adding an order value to the defined Workflow Stages. For this lab, we will choose Linear, since we have the most control over what we see. Select Stage Rendering: Linear. Stage Order: User Specified. Click Update.Select Gear Menu > Edit Stages.Select Import from Stage Set.Select K14-301 Custom Stage Column.Close the Workflow Stages list.To the Custom Stage Log Starting Log Message Activity, assign the Starting stage.To the Waiting Timer Activity, assign the Working stage.To Log Ending Log Message Activity, assign the Ending stage.Return to the main ServiceNow tab.In the Application Navigator Text filter type, K14.Select the K14 301s link.Click New.Fill out the form as follows: Name: Custom Stage Click Submit.Personalize the List Layout and add the Stage column after the Name field. If it does not look like that right away, refresh you list. It could just be your timer has not come back and completed the stage yet. Return to the Workflow Editor.Gear Menu > Edit Stages.In the Working Stage, change the value in the Order column to 600.Close the Stage List.Return to the K14 application. You can see the difference in progression in the workflow by submitting additional records.Click New.Fill out the form as follows: Name: Custom Stage Click Submit. Notice that the order of the icons has changed according to the user ordering specified in the Workflow Stage List. Ordering is one way the designer has to convey the status of a workflow. It is also possible to change the rendering format completely. Return to the Workflow Editor.Gear Menu > Publish. Gear Menu > Check out. Gear Menu > Properties. In the Stage Rendering field select SimpleProgressBar.Click Update.Return to the K14 application. You can see the difference in progression in the workflow by submitting additional records.Click New.Fill out the form as follows: Name: Custom Stage Click Submit. Your list should look like this: The icons and the progress bar are the currently available base instance rendering options for displaying the progress of a workflow. Summary Workflow Stage icons are a powerful way to reflect the progress of a workflow to users. The Workflow Engine can be configured to reflect icons in a variety of ways: In the order the process designer specifiesIn the order the Workflow Engine discovers stages as it executesStages only in the main flow with multiple subflowsAs a progress bar that reflects overall progress. The order and rendering of Stage icons is configured in the Workflow Properties form. The Workflow Engine will publish icons if: A table has a field of Workflow Type.A Workflow is written against that table.The Stage column has been identified in the Workflow Properties.Stages have been assigned to activities in a Workflow.