Join Gini von Courter for an in-depth discussion in this video Creating a simple workflow using the Send an Email action, part of SharePoint Designer 2010: Building Custom Workflows.
One of the actions that you're going to use the most is the email action, because you'll want to notify people all the time of steps in the workflow that something is ready for them to work with. So we're going to create a very simple workflow in our Shared Documents Library that only does one thing, when there is a new item that has been saved to the library, we are going to send an email to the person whose job it is to monitor the library's contents. Now in a SharePoint they could easily set an alert for this, but that wouldn't help us learn how to use the email action item.
So we are going to dive in and create this one-stop workflow and learn how to create email messages using this action in SharePoint. I want to remind you that we are going to work with the Shared Documents Library, there are no documents in it yet, it's a very basic library like you're used to in very single SharePoint site that you work with. And here we are in SharePoint Designer. We've already started it up, connected to this site by opening it. And we're going to List and Libraries, and there is our Shared Documents Library, and we can add a Workflow here. So we are going to choose List Workflow and give it a name.
I always start these with a verb, it makes it easier to think about what they are, and we are going to send an email to the library monitor. A Description is always a good thing, including, for example, who created this or what his purpose was. And I'm going to say that this was created by Gini Courter to notify the library monitor that a new document has been added to library. All good, click OK. Now we're ready to add an action. We are in Step 1. I'm going to go to Action > Send an Email.
You will find that right here under Core Actions if you haven't used it recently. If you have, it's up under Recent Actions. Now this works a lot like the rules do in Outlook, and in some other applications, where when I choose an action, and it needs more information there is a hyperlink, right now it's emailing these users, and we don't even know who they are. So I am going to go ahead and click on the hyperlink, and it's going to open Define Email Message form. So, I'm going to send this to olivia@twotreesoliveoil because she is the person who is the monitor for this particular library.
And the Subject, she is going to get lots of these, I'm going to send her out of the Current Item, the title of this document or the name of this document, they are actually the same. So I am going to say here's the document name. So she'll actually get an email that will have the name of the document in here. And now I can actually add some text that would be more explanatory. Olivia - The Shared Document library you monitor has a new document added by, and I am going to go to Add or Change Lookup, and we are going to go to the Current Item, and we are going to find out who created this item, that would be the Created By field.
So it has a new document Added By, Created By. Here's a link to the document. I am going to press Enter a couple of times so I don't have a URL running off the end of this line. And we're going to insert here an item that you will just absolutely want to remember because you are going to use it over and over and over again, which is the Encoded Absolute URL. So this is a URL that points directly to this document in the Current Item in the SharePoint list. I am going to say OK. So here's a link to the document. I need some way to sign this email message now when I'm all done, so I could say your SharePoint server, normally I will add something like, If you need more information about this SharePoint workflow, please contact--and it could be my contact information or someone else's, but we would put that here.
Particularly when we have a new person join our organization that isn't used to getting these kinds of emails, and they're like where do these come from, I can't even tell. So it's nice to do that. Because I'm testing I am actually going to put myself in here too, I will come back and edit this workflow later and remove my name from the workflow, and I am going to say OK. So this is my entire workflow. Now I have a couple of steps that I need to do in order to save and publish this. First I am going to click Save, that's all the more time it took to go connect to the server and to save it.
However, saving this alone does not make it available for use as a workflow yet. Let's go over and take a look. Here is our Document Library, and if I go to Library > Workflow Settings, I'll find that there are no workflows currently associated, my workflow is saved, but only saved for SharePoint Designer, I still need to publish it to associate it with this particular library. So here we are back in SharePoint, I want to publish this, but that's not all I want to do actually, I want to check it for errors, that's good, make sure it has no errors, and I'd like to publish it.
But I'm still in the Editor now, all I'm doing is listing steps. There is actually one more important thing I need to do. I am going to go back to my Workflow Settings, here's all the settings that pertain to my new workflow that I've created, Send email to library monitor. You remember a little thing called Start Options, one of the things that I need to do is say whenever a new item is created start this workflow automatically. If I don't do that the only way I can start the workflow is to do it manually. I will either need to tell my users, hey, start the workflow when you're done, or I'll need to go in and do that myself.
So we're going to start this workflow automatically when a new item is created. I am going to save and publish it again. If I ever need to come back and edit, or rename, this workflow you will find all of these tools right here under Workflow Settings. So that's all done. Let's go take a look at our library for just a moment. Now this is my Document Library Settings, I am going to refresh this. And when I do you'll notice that Send email to library is here, and it's actually here twice. Once when I saved it the first time I published it, the second time when I saved and published it the second time.
Between those two workflows if some user had jumped in there and had said, I am going to create a new document, they would actually be running the very first workflow, but it was only a matter of seconds, so not something that we need to worry about. And we'll talk later about what you do when you have workflows that are no longer being used and how you remove those. So let's go to our Library. If you're not really, really used to going back behind the scenes in SharePoint, I want to point out to you that these are breadcrumbs, and so I can go back to Share Documents by clicking right here, I don't have to go Home to get back there.
And now let's add a document here, I am going to browse, and I have a lot of different documents that I could use, but I'm going to simply use this document and post it to the library. There is some information I could fill in, I am all good on this so I am going to click Save. So here's my workflow, that workflow already executed. Here's the email that I was copied on. Notice it says to Olivia and to Gini, it comes from email@example.com, that's the domain.
But it says The Shared Document library you monitor has a new document added by, that's my exchange name, here is a link to the document. We could click on this. We are going to set this aside for just a second because I also want to show you that as a result of this workflow being published and running there is a new column with the name of the workflow, and this workflow is already completed and only had one step to do, we saw that it did it, and it didn't take that long. But when a user goes in I am going to go back to Home just so you can actually see the difference. And now when I open this email and click on the link, it should take me to shared documents and will actually prompt me to open that document that I had posted on the SharePoint site. So that encoded absolute URL goes directly to the document right here in the library, and I could simply say I want to open it now, or I could save it.
So our link works, our workflow works, everything is great. That's how you create a simple workflow using the email action in SharePoint Designer.
- Understanding workflows
- Documenting workflows with Excel, Visio, and the Office Drawing Tools
- Running the built-in workflows in SharePoint
- Understanding actions and conditions
- Working with if-then and if-then-else conditions
- Managing workflow messages with Outlook rules
- Pausing and stopping workflows with core actions
- Maintaining workflows with email aliases, workflow logs, and error traps
- Creating custom content types
- Creating a site workflow
- Exporting and publishing workflows