SharePoint Designer workflow: Allow users to enter an email address before running a workflow
Learn how you can create an initiation form for a SharePoint Designer workflow, so that users can enter data for the workflow to use when it runs.
You want to select a document in a SharePoint document library, start a workflow on this document, enter an email address, and then click to send an email to the recipient who is required to approve the document.
You can use an initiation form in a SharePoint Designer workflow to enter an email address (or any other data) before the workflow runs. The workflow can then use the data entered to perform actions.
To create an initiation form to manually send an email notification:
- In SharePoint Designer 2007, open the SharePoint site on which the document library is located.
- On the File menu, select New, and then Workflow.
- On the Define your new workflow screen of the Workflow Designer, enter a name for the workflow, select the document library you want to attach the workflow to, select Allow this workflow to be manually started from an item, and click Initiation.
- On the Workflow Initiation Parameters dialog box, click Add.
- On the Add Field dialog box, type Email Address in the Field name text box, and click Next.
- On the Add Field dialog box, enter an email address that should be displayed by default when the initiation form is shown, and click Finish.
- On the Workflow Initiation Parameters dialog box, click OK.
Figure 1. The Workflow Initiation Parameters dialog box in SharePoint Designer displaying a parameter for filling out an email address.
- On the Define your new workflow screen of the Workflow Designer, click Next.
- On the Step 1 screen of the Workflow Designer, click Actions, and then click More Actions from the drop-down menu.
- On the Workflow Actions dialog box, select Core Actions from the category drop-down list box, select Send an Email from the actions list, and click Add.
- On the Step 1 screen of the Workflow Designer, click the this message text of the Send an Email action.
- On the Define E-Mail Message dialog box, click the button behind the To field.
- On the Select Users dialog box, select Workflow Lookup, and click Add.
- On the Define Workflow Lookup dialog box, select Workflow Data from the Source drop-down list box, select Initiation: Email Address from the Field drop-down list box, and click OK.
- On the Select Users dialog box, click OK.
- On the Define E-Mail Message dialog box, enter text for the Subject and Body, and click OK.
Figure 2. Defining an e-mail message for a SharePoint Designer workflow.
- On the Step 1 screen of the Workflow Designer, click Finish.
Note: If you need to change the design (size of fields, etc.) of the initiation form, you can modify the .aspx file that SharePoint Designer automatically creates for your workflow when you add initiation parameters to your workflow, and re-publish the workflow.
The .aspx file is located in the folder for your workflow under the Workflows folder of the site in SharePoint Designer.
Figure 3. Initiation form as an ASP.NET form in the SharePoint Designer workflow.
Figure 4. Editing the initiation form of the SharePoint Designer workflow.
Testing the workflow
- Go to the SharePoint document library to which you attached the workflow, click on a document, and select Workflows from the drop-down menu.
On the Workflows page, click the name of your SharePoint Designer workflow. The workflow initiation form should appear with the default email address you entered when you created the workflow.
Figure 5. SharePoint Designer workflow initiation form to enter an email address.
- On the workflow initiation form, enter an email address, and click Start to send the email.
- SharePoint Designer workflow: Move a document from one library to another
- SharePoint Designer workflow: Send email when major versions of a document are checked-in
- 3 Ways to create workflows for WSS 3.0 and Office SharePoint 2007