Notifications

1647 views

On the Workflow Editor, "Set Inactive" and "Set Active" are not shown for some workflows

 

Problem
On a published workflow, when trying to change the Active field (true > false or false > true), the Set Inactive / Set Active UI action is sometimes not available. 
Symptoms
Follow these steps to see if the issue is occuring on your instance:
  1. Log in to a ServiceNow instance as a user with the admin or workflow_admin role.
  2. Navigate to Workflow > Workflow Editor.
  3. In the Workflow Editor, select a workflow that is used often and likely has active wf_context records using this workflow, for example, a workflow on the Change Request [change_request] table.
  4. To the left of the workflow name, click the menu icon .
    Note that the Set Inactive or Set Active UI action may not appear.

 

Cause


In our Java code, we have hard-coded the UI actions so that the Workflow Editor menu only displays the options to change the Active flag if the user has the ability to delete the workflow version. If the user cannot delete the workflow version, then they cannot set the Active flag on the workflow in the Workflow Editor.

By default, there is an ACL rule against the wf_workflow_version table (on the "delete" operation) that only allows a user to delete a workflow version under these conditions.

  • The user must have a role with workflow_publisher or workflow_creator (or have a parent role that inherits one of these roles such as admin or workflow_admin)
  • There must be no active Workflow Context records [wf_context] that are using this current workflow version
  • This workflow version is not being used as a subflow within another active workflow

If these conditions are met, a user can "delete" a workflow version, which subsequently means they can have the Set Inactive / Set Active option on the Workflow Editor as well.

 

Resolution


Warning: Ensure that the steps are tested on a non-production instance with extensive test cases before following the procedure on a production instance. The steps below can affect if workflows are triggered for new and existing records. Perform the steps with caution.

 

  1. Log in to a ServiceNow instance as a user with the admin or workflow_admin role.
  2. Navigate to Workflow > Workflow Editor.
  3. In the Workflow Editor, click a workflow on which you need to be able to change the Active flag.
  4. To the left of the workflow name, click the menu icon. 
  5. Click Checkout.
    Because a new version has been created, the Set Inactive option is available.
  6. Click Set Inactive.
  7. To the left of the workflow name, click the menu icon.
  8. Click Publish.
    Because the check out workflow version record has been modified to have the Published field as Published = True, the Active flag remains and the workflow remains as inactive.
  9. To set the Active to flag to True, navigate to the menu icon on the Workflow Editor and click Set Active.
    Note that this only allows you to be able to continue to have these Set Active / Set Inactive options as long as you meet the requirements as stated in the Cause section above.

Article Information

Last Updated:2017-03-17 14:26:21
Published:2017-03-17