Pages

Thursday, November 14, 2013

Send Email to Multiple Person or Group in SPD Workflow

SharePoint 2013 is forging ahead with great force and especially office 365 and SharePoint online is quickly becoming a new mantra for SharePoint implementation. SharePoint workflow is improved significantly in 2013 and there are so many activities that are deprecated especially the activities that we got used to in 2010 for Document Sets and impersonation etc.

Recently I had to create a SharePoint designer workflow in SharePoint online. The workflow is to send notification to users on their tasks. The objective looks simple correct? Yes, the workflow is also simple and it is one step workflow, but the devil is in the detail. The workflow needs to send email based on Assigned To Field in the tasks lists. As all of us know AssignedTo field take both Groups and users. So in a sense the workflow needs to email a group of people or send email individually to all users specified in the Assigned To field.

So far so good but here is where i stumbled upon. I used the send email activity and I chose the return type as "Email; Semi colon Delimited" as shown below.




Then I specified 2 users in the assigned to field and ran the workflow.



I had a Log to History activity in the workflow and what I found email delimited with semi colon in the History but Workflow failed to send email. Below is the error message I got.





After breaking my head as I cannot use Correlation ID in the error message because I am in SharePoint online and only way available is to send email to Microsoft with correlationid and wait for an answer. I was not ready to to that so I decided to try different option and finally found what worked like a charm. To send email to Group or multiple user instead of using "Email Address;Semicolon delimited" use "Login Ids; Semicolon Delimited" When I used as shown in figure the workflow sent out email fine both for Groups and individual users.





The example i have here is with users but the same works for Groups and i checked. I will update the images later.






Note: This approach is not going to help to send personalized email by adding user name for which we have to use other approach like using web services to get current user.

Hope this helps someone. Leave your thoughts in comments.





4 comments:

  1. This is the working solution and well explained. Thank you very much!

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Any suggestions for receiving a response back from each user indicating they acknowledge receipt of the email?

    ReplyDelete
  4. This works as well with the out-of-the-box approval workflow. Just open the Workflow, goto "single task behaviour" and edit the sent email under the Pending Task section. Delete the existing mapping and create the new one - it worked with "Return as Email" in my case though.

    ReplyDelete