Simple Document Sign Off - Part 6 - Notification Workflow

Introduction

The Notification workflow is triggered by the document owner and completes the following tasks:

  1. Generate Email to appropriate group.
  2. Create Link to source document for review.
  3. Create Link to sign off page to facilitate sign off.
  4. Provide end user with document version and change summary.
The notification workflow is triggered by the document owner after they have filled out the appropriate notification group(s).

Here is how you generate this workflow. First create a new workflow against the document library. Then, on the workflow settings page for this workflow, select "Allow this workflow to be manually started". And save. Now click edit workflow.



Condition

The first thing we want to do is determine who we are sending this workflow notification to. If the checkbox "notify all" has been checked for the document properties, then we want to send this email to all of this sites read only users. Otherwise, we want to send the email to the users or groups specified in the document properties "Notification_Group".

So, let's test for this value using the following simple logic:



Determine Notification Email Recipients

Now that we have the workflow logic, let's work on generating the email for both situations. The only difference between the two is who the email is going to. In the first case (Notify All), we are sending to all of the read only users in the site, like this:



My site is called "DocumentSignOffSource" so the group that I chose in the too field was "DocumentSignOffSource Visitors". This is the read only group for this site. Remember, in order for this to work, the sign off list needs special permissions set up earlier. Review the advanced permissions settings used if this doesn't sound familiar.

And the second email, for the situation where we want the notification email sent to a group or specific individuals, looks like this:



Generate Notification Email


Provide Document Name

First, we want to let the user know the name of the document they will be signing off on. This is included in both the subject line and the first line of the email:

Subject Line Document Name


First Email Line Document Name


The "[%Current Item:Name%] field is generated in the email subject by clicking the three dots to the right of the email subject, putting in the text "The document", then clicking the "Add Change or Lookup" and selecting the "Current Item", "Name" field.

The same field is used in the first line of the email, where the text is added directly to the email body and then "Add Change or Lookup" is used to get the document name.

Link to Document


We need to provide end users with a link to the document to allow them to review it before they sign off. First, add a line of text to the email saying "Access the document by clicking here for review". Highlight the word "here" and click the URL link button. In the screen that comes up, click the "Fx" button. Change "Current Item" in the data source drop down to "Workflow Context". In "Field from Source" choose "Current Item URL". It should end up looking like this:



Version and Change Summary


Now we want to let the user know both the document version and what the change summary is. Here is how we do that. First, enter the text in the email on its own line "This document version is ". Then click "Add Change or lookup" and select your current items version (built in field, you did not create this). Next, add the text "The change summary for this document is", click the "Add Change or Lookup" and select your current items change summary. This section should now look like this:



Generate Link to Sign Off Page





First, enter in the URL of your document sign off page. This is the entire URL to the page, not a relative URL. After you have entered the URL, add a question mark to the end, and add the text "&DocumentID=". Then click the "Add Change or Lookup" button and select "Current Item: WorkflowSetID". Your sentence should end up looking like the above image.

This creates a link to your sign off library that has the document ID appended. We use this document Id to extract other document information and keep track of the users sign off.

Your workflow email should now look something like this:



Create Custom Action Button on document properties

We now want to add a Notify button to the documents "edit Properties" screen. This button is pressed by the document owner when they want to send notifications. Mine looks like this:


Navigate within Designer to your document library. Click the document library name to bring up your library properties. We are interested in the "Custom Actions" section. Click the "New" button in the custom actions section.

Name your action "Notify". Add a description for the notify action, mine is "Sends document sign off notifications to the sign off group associated with this document. If notify all is checked, sends sign off noticed to all read level permission users of this site.".

In the "Select the type of action" section choose "Initiate Workflow:" and select the workflow you created for notification.



If you wish, you can also specify a 16x16 or 32x32 icon to display as your button in the "Advance custom actions options" section. This is optional, if you don't choose a button image, it will simply display your "Notify" text on the screen.

Test what you have so far

Now that you have the workflow up and running, time to test it. Add a new document to your document library. Open the edit properties for that document. Enter in your username in the "Notification_Group" field. Add some text to the change summary. Click save.

Now open the edit properties window again, and this time click the "Notify" button you added in the prior step. This should take you to the workflow start screen. Select your notification workflow and click "Start".

You should be sent the notification email. Ensure the information in the email is correct, test the links, and click the sign off link. It should take you to the sign off page. Click the "I have read this document and understand the content within" checkbox and click "register choice". You should now be redirected to the welcome page you created earlier.

Take a look in your sign off list. You should now see a sign off record with your document ID and Document_Read_Flag set. If this doesn't work, don't move forward, get these components working first.

Don't worry about those blank fields in the document sign off record, those will be filled in by the sign off workflow that we complete next.

<- Simple Document Sign Off - Part 5 - The Sign Off Page Simple Document Sign Off - Part 7 - Sign Off Workflow ->

No comments:

Post a Comment