Simple Document Sign Off - Part 4 - Setting the Document ID

Setting a document ID

The document ID is a unique field that identifies each document. It is more useful than document name or other fields for our purposes because it never changes. So, a document in this system could have its name changed, but would still have all components function correctly. We use this document ID when a user signs off to identify the document the sign off is associated with. So lets set this up.

We set the document ID using a simple workflow called "Extract and Save Document ID". This workflow should be set to be run whenever an item is created, or can be triggered manually:

Next, we configure the workflow itself. I create workflows using workflow variables for clarity. The workflow below completes the following tasks:

  1. Test to see if the WorkflowSetID has been set already. Do nothing if it has
  2. Set the local variable (already created) to the current items ID value. ID value is a built in field on your document library:
  3. Set the value WorkflowSetID to the extracted ID value stored in the local variable.
Here is the completed workflow:

Updating existing documents

If you have no documents existing in your current system, then this workflow will handle all ID value setting as it should. However, if you have existing documents in the system, their workflow ID value will not be set, and sign off will not work on those documents.

For any existing documents, you will need to trigger the set document ID workflow manually. To do this, locate the document in the document library, click the three dots to the right of the document, and select "Workflows". Select your "Extract and save document ID" workflow and run it. This will set the document ID for that document. Repeat for each existing document.

If you have large number of documents, and you have SharePoint 2013 workflows that support looping, you could create a workflow that runs once and updates all ID values. This is beyond the scope of this article however.

<- Simple Document Sign Off - Part 3 - Prerequisites and List/Library Setup Simple Document Sign Off - Part 5 - The Sign Off Page ->

No comments:

Post a Comment