Archives for: October 2007, 08

A user posted the following question on the TechNet SharePoint discussion board:
We have a custom list that I need to create a workflow that will fire off an email message when a person is added to the list. Their email is captured in one of the columns. This would be my first workflow and I'm not sure where to start. Anyone point me in the right direction or share some code? Thanks.

Here's how you can do this in SharePoint Designer.

First off, the user said they're using a custom list that has an E-mail field. Here's a sample custom list, with a field called "E-mail":

Custom List

To create the workflow, open up SharePoint Designer and open up your SharePoint web site. Right click on the root of the site and select "New", then "SharePoint Content". Click on the Workflow tab and select "Blank Workflow" and press the OK button.

New Workflow

The first screen you come to says, "Define your new workflow." Give your workflow a name. Then select the list you want to apply the workflow to. (In the case of our example, it's "Employee Custom List". You have several options as to when the workflow gets kicked off. In this case, we'll say the workflow gets kicked off every time a list item changes. You can also say that it gets kicked off when an item first gets created.

Define Workflow

Once you have finished making your choices, click the "Next" button.

The first step is to decide what condition you're evaluating. In this case, we want to see if the E-mail field has been populated. To do this, we'll click on the "Condition" button, and select "Compare Employee Custom List field".

Compare Field

You will see the sentence "If field value equals value". Click on the "field" link, and a list of all the fields in the custom list will appear. (These include built in fields that you did not explicitly define on the list, such as Approval Statuas, Modified By, etc.) Select "E-mail" from the list.

Select Field

Next, click on the "Equals" link. Select "Is Not Empty" from the drop down list. Now you have your condition in place. Your sentence should read, "If E-mail is not empty." Now, we'll work on the Action statement. Click on the Actions button, and select "Send an E-mail" from the drop down list. You will see the sentence, "Email this messgae." Click on the "this message" link. A window will pop up that looks like an e-mail.

At this point, you can either type in your own static e-mail, and hard code which user or group you want to send the e-mail to, based on whom has been given rights to your site. In our scenario, let's send an e-mail to the person who just got added to the list. To do this, click on the address book icon to the right of the "To" field. You'll see your choice of users. In this case, we want to use a dynamic value. Click on "Workflow Lookup" and click the "Add" button.

Select Users

Another window will pop up, asking you to select the Souce and the field. Select "Current Item" from the first drop down list, and select "E-mail" from the Field list.

Lookup Details

Click the "OK" button, then click the "OK" button again. Now you should be back to your e-mail. We'll do a similar process for the subject of the e-mail. Click the symbol to the right of the subject line, select "Current Item" from the source, and then "Employee Name" from the list of fields, then click "OK". Finally, write a message in the body of the e-mail, such as "Your e-mail address was added to the Employee Custom List." Your sample e-mail should now look like this:

Email Configuration

Now add a second action below the action to send the e-mail. Select "Stop Workflow". (If this doesn't appear in your list, click the "More Actions..." link.) The sentence will appear, "then Stop the Workflow and log this message." Change the "this message" to say something like "Email Workflow completed." (Without adding a message, the workflow will not compile properly.) Click Finish and you are finished with your workflow!

Now try it out. Go to your list, and update an item in your list, by adding an e-mail address. The recipient's e-mail should look like this:

Result E-mail
October 2007
Sun Mon Tue Wed Thu Fri Sat
 << < Current> >>
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

Search

free blog software