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.
Set up a workflow with the following actions:
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:
Our Email action just puts together all the variables we created and defined:
With all that in place and published (and the workflow added to the dropdown list item menu), I can launch the workflow like so:
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:
When I fill out the form and click Start, here’s the email I end up with:
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.