Alerting Blog author when comments are added

SharePoint blogs allow people to comment on blog posts but unfortunately the blog author is never alerted when a comment to their post is added. Using a Nintex workflow you can add that functionality to a SharePoint blog.

1. First we will create a new column on the ‘Posts’ list so the post author can choose whether to be notified when new comments are created or not. To do this, go to the Site Actions gear in the top right, and click on the ‘Site Contents’ option. On the Site Contents page you can hover over the Posts list, click on the ellipses, and choose settings.
2. Once in the Settings of the Posts list, click on the ‘Create column’ link under the columns section. Create the column so Name: Comment Notification, Type: Choice (menu to choose from), Description: Would you like be notified of comments on this post?, Require: Yes, Choice: Yes No, Display choices using: Drop-Down Menu.
3. We now need to create the workflow on the Comments list. To do this return to the Site Contents page and this time click on the ‘Comments’ list. On the Comments list click on the List tab then select Create a Workflow in Nintex Workflow from the Workflow Settings dropdown.
4. Since the Workflow is on the Comments list, we need to first query the posts list to get information about the post the comment has been added to. To do this add a Query list action to the Workflow.
5. Click the dropdown next to the Query list action and select configure. On the Configure Action screen do the following:

A. Select the Posts list from the dropdown
B. In the filter section, choose the select items only when the following option.
C. Change the dropdown to the ‘ID’ column
D. Click on the Insert Reference Icon in the is equal to filter box.
E. Select the Item Properties Tab
F. Select the Post ID column. Click OK which should populate the is equal to filter box with the Post Id reference.
6. In the Sort section of the Configure action screen, in the Field dropdown select the Comment Notification field and click the Add button. Then choose the Created By field and click the Add button. The two fields you just added will be displayed beneath the Field dropdown section, but if you click on them you will not have any options:
7. We now need to create Variables to store the Comment Notification and Created By values in. At the top of the Configure Action screen, click on Variables. Then click on New in the Workflow Variables screen. And finally enter a name for the Comment Notification Variable and make it single line of text, click on Save to create the variable.
8. Repeat those steps to create a single of text varialbe for Created By as well. Once you have both variables created like shown below, click on the Close button to close the workflow variables screen.
9. Now set the Comment Notification and Created By fields to populate your two new variables. Once completed your Configure Action screen should look like this:
10. We will now add a condition to check whether the post author chose to be notified of comments are not. To do this Add a ‘Set a condition’ action to your workflow.
11. Configure the action so the Condition selection is ‘If any value equals value’, Where ‘Workflow Data’ ‘VarCommentNotification, and for Value just type in ‘Yes’.
12. Under the Set condition action on the Yes side, we are going to create a ‘Set variable’ action to get the display name of the person who created the comment for our email. If we just used the ‘Created By’ field, this would return the users fully qualified login name instead of their display name.
13. Configure the Set variable action, and then click on the Variables option. On the Workflow variables screen Click on the New icon and create a new single line of text variable for the Created By Name. Once your variable has been created click Close.
14. On the Configure action screen, Set ‘VarCreatedByName’, Equals ‘User Profiles’, Source ‘Name’, Equals Value: click on the Insert Reference icon and find the ‘Created By’ field reference. Please see the Getting User Profile values article if you have questions on this step. Once your action looks like the one below, click Save.
15. The last action will be to ‘Send notification’ to the Post Created By person.
16. Configure the Send notification action, for the To section click on the Phone book. Then on the Select people and groups screen expand the ‘Lookup’ section and choose the VarCreatedBy Workflow variable.
17. Enter a Subject for the email, I’d recommend including the Title field reference in the subject so the post author knows what post the comment is in reference to. Then add the text and field references in the body so it looks like the example below. Once the send notification action is setup, click on the Save button.
18. The final step is give the workflow a name, description, and set the start condition for the workflow. Click on the Workflow Settings icon, Type in a Title, Description, and for Start when items are created: choose the Yes option. Save your settings and Publish the Workflow.
** It’s a good idea to edit the actions to add descriptive titles to each of the actions while they are fresh in your mind. This way it’s obvious what each action does for anyone else looking at this workflow.

Finished Example: Now when someone adds a comment to a blog post, the person who created the blog post will be notified via email:

About Nick Hurst (85 Articles)
SharePoint and Nintex developer who strives to find easy to deploy and maintain solutions for business problems.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: