Send a basic e-mail message from a workflow
By using the Send an Email action in the Workflow Designer, you can set up your custom workflow to send e-mail messages to you or to any other specified user or group. The available fields for an e-mail message are To, CC, Subject, and Body. These fields can contain both static text and text that is generated dynamically from workflow lookups.
You can use the Send an Email action to generate many kinds of messages, including notifications when the workflow reaches specified stages or performs specified actions (including the overall starting and stopping of the workflow) and reminders about tasks that are not complete by their due date.
Note Outgoing e-mail settings must be configured on the server before your workflow can send e-mail messages. If you are unsure about the server's current e-mail settings, check with your server administrator. Find links to more information about outgoing e-mail settings in the See Also section.
In this example, you will set up your workflow to send you an e-mail notification each time that it starts to run on a new item.
- On the File menu, point to New, and then click Workflow.
- On the first page of the Workflow Designer, name the workflow, indicate the list or library that the workflow will be attached to, and then select the check boxes for the start options that you want.
- Click Next.
- On the next page of the Workflow Designer, type a name for this step of the workflow.
- Click Actions, and then click Send an Email.
If this action does not appear in the list, click More Actions to see the full list.
- In the action, click this message.
- In the Define E-mail Message dialog box, enter your own e-mail address in the To box.
Notes
- To select users from a list or address book, click the Address Book
button at the end of the ?To? box.
- The ?To? address of a message can either be a specific, static address (for example, contoso\user1 or user1@contoso.com) or a workflow lookup to variable information. The sender address of the rendered message will always be the e-mail address of the server administrator, unless the server administrator changes the sender address for either the current Web application or all Web applications.
- In the Subject box, type a subject for the message, or click Display data binding
to define a workflow lookup to the text you want here.
Note You must make some entry in the Subject box in order for the workflow to compile correctly.
- In the large box under the Subject box, type or paste the body text of the message.
Tip No shortcut menu is available in this box. To copy text, press CTRL+C. To paste copied text, press CTRL+V. Text that you copy and paste cannot include any workflow lookups.
At this point, you could click OK to finish the message. On the other hand, it might be useful to include the title of the new item that has started the workflow, or even to include a link to that new item. Following sections will show you how to do those things, and also how to format the appearance of the message text. First, though, you will learn how to use workflow lookups to address your message dynamically.
Include information about the current item
So far, the body text in the example message is static: Every time the workflow creates an instance of the message, the text will be exactly the same.
It can be useful, however, to include text that changes in relation to the item on which the workflow is currently running. For example, it might be useful to include the title of the document needing review in the body of your message. To include this sort of dynamic information, you use a workflow lookup. Lookups retrieve data from different data sources such as lists, libraries, and workflow data.
To add the title of the document to the message text:
- Type or paste the static text within which you want the lookup information to appear.
- Position the insertion point where you want the lookup to be located.
Tip Once a lookup is inserted, it cannot be dragged to a new location. (It is possible, however, to "relocate" a lookup by dragging other text around it.) Similarly, it is not possible to cut, to copy, or to paste either a lookup or any text that includes a lookup.
- Click Add Lookup to Body.
- In the Define Workflow Lookup dialog box, select Current Item in the Source box and Name in the Field box.
- Click OK.
The inserted lookup appears in the message body.
When the workflow runs and the messages are generated, the lookup is replaced by the title of the document.
Including the title of the document is useful, but it might be even more useful to include a hyperlink that would take you directly to the document itself. To do this, you include a lookup in the hyperlink.
Include a static hyperlink
You can include a static hyperlink ? that is, one that always links to the same address or location ? in the body of your workflow e-mail message by using the HTML anchor tag (<a> and </a>) with the href attribute and specifying the target address as the value of the href attribute.
To visit the Microsoft site, click <a href="http://www.microsoft.com/">here</a>. In the resulting message, the text between the anchor tags is rendered as a hyperlink to the specified address.
Note Some text-based e-mail programs are not capable of rendering HTML coding, and thus will not render the hyperlink.
To learn how to use a workflow lookup to create a dynamic hyperlink that points to varying addresses depending on the item on which the workflow is currently running, see the next section; Include a hyperlink to the current item.
Include a hyperlink to the current item
In the previous section, Include a static hyperlink, the address in the example hyperlink includes no variable information: Every time that the workflow sends the e-mail message, the hyperlink points to the same page.
By using a workflow lookup, however, you can create a dynamic link that uses information about the current item to decide which URL to point to.
If the current item is a document in a document library
In the workflow startup notification example, you might want to provide a link to the new document itself:
- Type or paste the static text within which you want the link to appear.
- Where you want the lookup to be located, type the following text.
<a href="">here</a> Tip Once a lookup is inserted, it cannot be dragged to a new location. (It is possible, however, to "relocate" a lookup by dragging other text around it.) Similarly, it is not possible to cut, to copy, or to paste either a lookup or any text that includes a lookup.
- Position the insertion point between the two double quotation marks ("").
- Click Add Lookup to Body.
- In the Define Workflow Lookup dialog box, select Current Item in the Source box.
- In the Field box, select Encoded Absolute URL, and then click OK.
When the recipient of the message clicks the link, the document opens for viewing or editing.
If the current item is a list item
When you create a link to a list item ? for example, an announcement or a calendar event ? you can choose to have the link open either the display form (DispForm.aspx) or the edit form (EditForm.aspx) of the list item.
To create a link that opens the list item for a document (instead of the document itself):
- In the browser, navigate to the Shared Document library.
- Open the list item for any existing document in the library, using View Item if you want your link to open the display form or Edit Item if you want your link to open the edit form.
- Copy the address in the address bar from the beginning http: or https: through the first equal sign (=), as shown in the following illustrations.
The ?ID= text is a query string parameter that instructs the page to display the form for whichever item in the current list or library has the list ID that follows the equal sign (=) ? which in this example will be the list ID of the current item, as identified by the workflow lookup.
Reference
http://office.microsoft.com/en-us/sharepointdesigner/HA102390421033.aspx?pid=CH100667661033
MILLICOM INTL CELLULAR MOBILE TELESYSTEMS NANYA TECHNOLOGY NII HOLDINGS NIKON
No comments:
Post a Comment