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.

ADVERTISEMENTS

Scenario

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.

Solution

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:

  1. In SharePoint Designer 2007, open the SharePoint site on which the document library is located.
  2. On the File menu, select New, and then Workflow.
  3. 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.
  4. On the Workflow Initiation Parameters dialog box, click Add.
  5. On the Add Field dialog box, type Email Address in the Field name text box, and click Next.
  6. 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.
  7. On the Workflow Initiation Parameters dialog box, click OK.

    The Workflow Initiation Parameters dialog box in SharePoint Designer displaying a parameter for filling out an email address

    Figure 1. The Workflow Initiation Parameters dialog box in SharePoint Designer displaying a parameter for filling out an email address.

  8. On the Define your new workflow screen of the Workflow Designer, click Next.
  9. On the Step 1 screen of the Workflow Designer, click Actions, and then click More Actions from the drop-down menu.
  10. 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.
  11. On the Step 1 screen of the Workflow Designer, click the this message text of the Send an Email action.
  12. On the Define E-Mail Message dialog box, click the button behind the To field.
  13. On the Select Users dialog box, select Workflow Lookup, and click Add.
  14. 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.
  15. On the Select Users dialog box, click OK.
  16. On the Define E-Mail Message dialog box, enter text for the Subject and Body, and click OK.

    Defining an e-mail message for a SharePoint Designer workflow

    Figure 2. Defining an e-mail message for a SharePoint Designer workflow.

  17. 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.

Initiation form as an ASP.NET form in the SharePoint Designer workflow

Figure 3. Initiation form as an ASP.NET form in the SharePoint Designer workflow.

Editing the initiation form of the SharePoint Designer workflow

Figure 4. Editing the initiation form of the SharePoint Designer workflow.

Testing the workflow

  1. Go to the SharePoint document library to which you attached the workflow, click on a document, and select Workflows from the drop-down menu.
  2. 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.

    SharePoint Designer workflow initiation form to enter an email address
    Figure 5. SharePoint Designer workflow initiation form to enter an email address.

  3. On the workflow initiation form, enter an email address, and click Start to send the email.

Related Articles

ADVERTISEMENTS