Saturday, October 25, 2014

Lookup To address from list in SharePoint 2013 designer workflow




In this post we will discuss how we can lookup To address from a SharePoint list while sending emails using SharePoint 2013 designer workflow. If you have put any static email id in the SharePoint designer workflow for sending emails, then any time you need to change the recipients, you must open the workflow in the Workflow Designer and make the changes manually. So it is better to lookup the To or CC field from a list.

Also check out:


So first create a SharePoint custom list and the column which will contain the email id can be a Single line of text, Multiple lines of text, or Person or Group type columns. If you use a Person or Group column, only one entry can be made in each field that the workflow will reference for e-mail addresses. When creating the column, be sure to select No under Allow multiple selections. If you want to use this type of column to specify multiple recipients, you can create a SharePoint group that includes the people that you want the workflow to address the e-mail to, and then specify the group in the field. When creating the column, be sure to select People and Groups under Allow selection of.

In our case we will create a column which will contain a single user. For user convinient rename the Title column to Workflow Name and other column say WorkflowToId. Then we will add one item to the list Where the Workflow Name="My Test Workflow" and the WorkflowToId=bijay@enjoysharepoint.com and save the item. So the list with the item will look like below. Here Workflow Name is also important because we need to give this value in the designer workflow.


Now open you workflow in SharePoint designer 2013 and then click on the To icon to open the Select User dialog box. In the dialog box, click on "Workflow lookup for a User...". This will open the Lookup for Person or Group dialog box. Here in the datasource choose the list name that we made in above, and then Field from source the column name that contains the email id, in our case the column name is "WorkflowToId". Then in the other section, choose Field as the Title column of the new list, in our case we rename it as "Workflow Name" and then in the Value box write the value presented for that column. In our case it is My Test Workflow.
The dialog box will look like below:


After this the email will be send to the To address which is presented in the list. So afterwads if you want to change the To email id, simply change in the list, no need to open the workflow. If you want to add more To address, then you can add additional columns and store and use like above.


0 comments:

Post a Comment

Twitter Delicious Facebook Digg Favorites More