Send Emails After Note Board Comments

The SharePoint web part Note Board is a very useful tool add to pages so users can post comments to the public. Unfortunately Note Board saves users’ comments in each users’ profile in MySites rather than a SharePoint list, so workflows cannot be triggered after a new comment.

Problem

  • There is no native SharePoint way to send emails after Note Board comments have been created.

Solution

  1. Use JavaScript to update a field value in a list on the same page as your Note Board web part. This code will be triggered each time the “Post” button is clicked on the Note Board web part.
  2. Set up a workflow that triggers after an item is changed, and looks for this new value.
  3. If the new value is set, send an email notice to the recipients.
  4. Set the list value back to its’ default value so this cycle can continue in the future.

If you haven’t already added the Note Board web part to your page, you will find it under the “Social Collaboration” web part category:

Then create a text field in a list that lies on the same page as your Note Board web part, which I will call “NewChatText”. Next, add the JS code below into your page to set the value of the newly created NewChatText field with the text “updated” (you will need to use the proper element selector for that fields’ text value). I would recommend hiding this field with CSS or JS because it does not need to be seen by the end user.

function updateNewChatText() {
    var postBtn = $("input[id$='PostBtn']");
    var newChatText = $('td#newChatText input').first();

    postBtn.on('click', function() {
        newChatText.val('updated');          // The workflow will look for this value to determine whether or not to send an email.
    });
}
updateNewChatText();

Now that the Note Board web part, text field, and JS code are in place, you can see the results of this.

Initial form, before a comment is posted:

After a new comment:

Lastly we need to create the workflow that determines if NewChatText has the value of “updated”. If so, send an email, then set the field value back to an initial value, which we will set to “0” here. The workflow should be triggered after the list has been changed.

And that’s all there is to it- if you want to add something to the discussion please let me know in the comments below.