Creating a Send Email workflow for a list item

In one of my projects, the customer had requested a feature that would allow them to send an email notification about a list item to someone.  In my former life as a Notes developer, this was a no-brainer given the fact that the Notes client was both the application and email client.  But in SharePoint (at least at my level of knowledge so far), it wasn’t quite as easy.

I was working from a list (not a document library), and I used InfoPath to customize the list form.  I didn’t want to add columns onto the list to manage send to, copy to, subject, and email body fields.  I wanted them to be able to “click a button”, get a form they could fill in to add addresses and an email body (all under their control at the point they go to send it), and then send it from there.

I ended up with a workflow built in SharePoint Designer 2010 that works pretty well for what they wanted.  To try and save you a few minutes (or hours) of time, here’s what I did…

Create a new workflow in SPD and set it to run manually.  I also added the workflow to the dropdown list item menu for the targeted list.  That way they don’t have to click on the Workflows option to get to the screen that lists the available workflows first.

Add three workflow initiation variables that will prompt the user for values when the workflow is triggered.

20121207Image01

Set up a workflow with the following actions:

20121207Image02

The first Set Variable: ItemLink just builds the URL for the site, and ends with “ID=” and the current value of the ID field for the item.  The EmailSentBy variable is the person who is sending the email, and the DoNotReplyStatement variable is some boilerplate text to let people know that the Reply To address is not the person who sent the email, but is the system email address for the SharePoint environment.  That variable looks like this in the String Builder window:

20121207Image03

Our Email action just puts together all the variables we created and defined:

20121207Image05

With all that in place and published (and the workflow added to the dropdown list item menu), I can launch the workflow like so:

20121207Image04

When the workflow starts, I get prompted for the initiation variables, which gives me a nice looking dialog box for the user to fill in:20121207Image06

When I fill out the form and click Start, here’s the email I end up with:

20121207Image07

The person sending it was able to add any explanation they wanted, the recipient has a link to the list item, and we have the explanation telling them not to do a reply to this email, as it won’t go back automatically to the sender.  Of course, I know they’ll ignore that and click Reply anyway, but at least we tried.

Hopefully this will make it a little easier for you to add the same functionality to your list if and when a customer asks for a similar feature.

11 responses to “Creating a Send Email workflow for a list item

  1. Charles Robinson

    Is it not possible to set the ReplyTo or From to the person who kicked off the action? Those are standard mail fields so it shouldn’t be too terribly difficult. I know it can be done in SQL Server so I would be surprised if there wasn’t a way to make this work from Sharepoint.

  2. If there is, I certainly haven’t found it. You definitely can’t do it through an SPD workflow. I believe that in the SharePoint environment, emails generated by workflow or SharePoint end up using the email address of the system account (unless you install apps in different farms or some such stuff like that… I’m not an admin!) As a result, you get things that say they came from “Compensation” but the email address is the SharePoint admin account. If I was able to find a way (out of the box) to be able to specify the Reply To address for workflows (without having configuration/administration involvement), I’d be thrilled.

  3. Patti Naccarati

    Is it possible to set the SendTo to email addresses that are in one of the fields in the list? For example, I have a field called “Owner” and it displays email addresses (selected from AD) for people who “own” that list item. Is it possible to send an email to people in that field?

    • Exactly what I am looking for too. I have a list where I want the requestor to be included in the notification email when the item gets updated. I can’t believe this is so difficult!

  4. I am having difficulty getting to work at all. I get a form to fill out, but no people picker.

    • To be more specific I am not able to use infopath to manipulate the SendTo and CopyTo fields to bind to a People Picker.

  5. Not sure what would be happening. I set the SendTo and CopyTo fields in the Initiation Form parameters to be an Information Type of Person or Group. When I do that, I get the normal People Picker style control when the Initiation Form is displayed. If you just used an Information Type of text, you’d need to change that.

  6. Marko Blokovi

    Hi,

    I need sharepoint to only compose email,and open it, but not to send it. Is that possible?

  7. You hve just gained another reader! Do you have
    a ews letter sign-up available?

  8. How you have added a (Send email notice) in the drop down ?

  9. Hello,

    In my case sp 2010 Parameters are not replaced by variables set on init 😦
    What I am doing wrong?

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s