Compartilhar via


Discussion Thread Reply Problem

Today we are going to address the practical problem of notifications in a discussion thread. The case study is that I would like the owner of a discussion topic to receive email notifications whenever someone replies to their particular thread. I also do not want to write code (elimination of SPAlert through list item even receiver). We can't do an alert because the whole list is managed by several people and replies must be dynamic.

In comes workflow through SPD (SharePoint Designer) to save the day.

First, create a workflow in SPD:

You must then define your new workflow and set the parameters.

  • Give this workflow a name you can remember
  • Make absolutely sure that the discussion board you are trying to modify is chosen as this will determine the fields available later in the workflow
  • Only choose "Automatically start this workflow when a new item is created" as we don't want manual intervention and changes may not be warranted.
  • When Complete, chose next

We will then set the conditions parameter up. This will trigger this workflow if it meets the conditions you supply. In this case, we are simply going to tell the workflow to fire if this is not a root post. In other words, all replies will trigger this workflow and the initial creation of the thread will not. Also notice that we are giving this particular step a name.

When completed conditions, your screen should look like the below as "0" means false in this case:

Now we are going to focus on "Actions". This determines what the workflow is actually going to do. In this case, we want to email the discussion thread owner and so we are going to choose "Send an Email".

In the "To" field we can have a "workflow lookup" which will run a workflow within a workflow. Essentially what we want to do is determine the owner of the thread based on the current item's data. So if John Doe sends a reply to Jane Doe, we don't want to email Jane Doe.

So if you look at the filled out properties you can see that we are going to send it to the "created by" field of the top level thread. We are mapping the current item to the Discussion thread by the current Item's Parent Folder ID to the ID of the thread. This will pull back the created by owner and here is the magic.

Finally we can choose Finish and we are complete with the workflow after testing of course.

I hope this thread has been helpful to you and cheers!

Comments