Managed Documents Workflow

jamesmiller
Kilo Contributor

We are currently in the process of implementing the Managed Documents application in our instance of ServiceNow.   We have found that the default workflow setup for document versions will not work for what we would like to implement.   We would like to review and approve documents based on workflow that routes the document "container" for review while allowing users to add versions into the application.   Once the review is complete we would want to take the last version that was uploaded and then publish this to a KB for end users to reference.  

We are currently experiencing an issue with the workflow that is attached to the document "container" (dms_document) table.   It will fire the first time without issue but any attempts to fire the workflow a subsequent time does not work.   Are there any restrictions on this table that prevent a workflow from running more than once?   What might be causing this issue?

Below is a high level outline of the process we currently have built:

Create a new document and complete required information

Default field of state = Draft

Added new form button to the Managed Documents screen which when clicked changes the state of the document "container" to awaiting review

The workflow which is attached to the Managed Documents application fires automatically when the state = awaiting review

The running workflow record can be seen from the Managed Documents screen by means on a related list which was created via a new system relationship

Like stated above the initial run of the workflow works without issue, it is changing the state back to draft and attempting to click the button a subsequent time to pick up the workflow, produces no results.

Let me know if you have any questions or need any further information on what was described above.

Thank you,

Jim

7 REPLIES 7

rajeevlochan82
Mega Guru

Can you elaborate your issue. The workflow is trig-erred once so how you expecting it to start again ? You can put conditions in your workflow to go to different stages / steps or to go to beginning of its flow but did not get your point of workflow not triggering again altogether.


Hello Rajeev,



You are correct the workflow is triggered once but then will not run any subsequent times.   The workflow itself is triggered by a custom field "State" on the document table.   The default value of this field when the document is created is "Draft" but when the custom UI Action button is clicked the "State" field is changed to "Awaiting Review".   Once this change is made the test workflow which is associated to the Document table is kicked off.   I can verify this by going to the active workflow contexts and also by a related list which I built into the document form, see below for screenshots:



Creating a new document:


find_real_file.png



Document is created and showing in the MD application:



find_real_file.png



Document detail:



find_real_file.png



Clicking the "Review/Approve Document" button will change the State from Draft to Awaiting Review, see the code behind the button below:


find_real_file.png


the first completion this process, the workflow starts with no issue, see below:



Active Workflow showing in the custom related list named "Document Review/Approvals":



find_real_file.png


Active workflow showing on the "Active Contexts" section of workflow application:



find_real_file.png



Once the workflow is completed (The document is reviewed and approved by all required), the related list shows no active records:



find_real_file.png


There are no Active Contexts so the workflow finished:



find_real_file.png



When completing this process a subsequent time, for the time being I have to manually modify the document state to "Draft" again:



find_real_file.png


Once this is done, and we need to begin another review, the Review/Approve Document button is clicked, which changes the state back to "Awaiting Review":



find_real_file.png


There are no new rows in the customer related list:



find_real_file.png



Also, no new records in the "Active Context" menu:



find_real_file.png




Why would the workflow start the first time and then not start any subsequent times after that?








****Additional information below*****:



Workflow detail:


find_real_file.png



find_real_file.png



Custom UI Action Detail:



find_real_file.png



Document Review/Approval Related List:



find_real_file.png


Hi James,



If there is any workflow associated with a Record with any start condition and the workflow is trig-erred after meeting the start conditions then please note that


there will be only one instance of this workflow which will be started........If you switch workflow start conditions then even though you again meet workflow conditions , no new instance of this workflow will start. This is default service-now behavior. If there is some workflow associated with a record then only one instance of workflow is created even if you meet workflow start conditions multiple times.



what is the need to trigger same workflow multiple times ?


Hello Rajeev,



Thank you for the information above.



We need to trigger the workflow multiple times because a document can be reviewed year after year to make sure it still contains the most appropriate information.   Your reply helps me to understand why document revisions always are able to kick off a new workflow that is the same, each revision is a new unique record.   Our thinking behind reviewing the "document container" is to allow people to add as many revisions to the stack while it is being routed for approval.   When it gets to the end the latest revision is then published out to a knowledge base for end users to view.



The issue with using the standard out of the box process for MD is that each revision is attached to a workflow, when that revision is sent around for review/approval and someone needs to make changes, the entire process must be stopped and restarted with a newer revision.



Is there anyway around this to force the workflow to occur more than once for the same record?



Thank you for your help.