Creating Custom List Workflows - Exercise

Contact Us or call 1-877-932-8228
Creating Custom List Workflows - Exercise

Creating Custom List Workflows

Duration: 15 to 25 minutes.
  1. Navigate to your team site.
  2. Import the Time-off-request-list-template.stp list template file and create a new list using the template. The new list will be used later in the exercise with a custom workflow.
    1. Click the Settings menu then click the Site Settings option. Exercise - Custom Workflows
    2. Click the List templates link on the Site Settings page within the Web Designer Galleries group. Exercise - Custom Workflows
    3. Click the FILES tab to open the toolbar then click the Upload Document link button. Exercise - Custom Workflows
    4. Click the Browse button in the Upload Template dialog.
    5. Navigate to the folder you downloaded the class files to and select the Time-off-request-list-template.stp file and click the Open button on the Choose File to Upload dialog window.
    6. Click the OK button on the Add a template dialog. Exercise - Custom Workflows
    7. Click the Save button on the List Template Gallery dialog to save the file into the gallery.
    8. Click the Settings menu then choose the Add an app option. Exercise - Custom Workflows
    9. Type "time-off" in the search field and click the search icon. Exercise - Custom Workflows
    10. Select the Time-Off Requests template from the list template. Exercise - Custom Workflows
    11. Type "Time-Off Requests" in the Name: field and click the Create button to complete creating the new list. New list.
    12. Click the Time-Off Requests link in the Quick Launch and verify the new list has the following columns: Name, Start Date, End Date, Reason, Manager, and Manager Feedback.

      The columns were defined in the list template that the list was created with. If the list does not have these columns, make sure the list was created with the template imported in the earlier steps.

      Exercise - Custom Workflows
  3. Open the site in SharePoint Designer 2013.
  4. Using SharePoint Designer, create a new List Workflow for the Time-Off Requests list.
    1. Click the List Workflow drop-down button on the Site tab toolbar within the New group and select Time-Off Requests from the list. Exercise - Custom Workflows
    2. Type "Time-Off Request WF" in the Name field of the Create List Workflow dialog window and click the OK button to finish creating it. Exercise - Custom Workflows
  5. Add a Log to History List action to the new workflow.
    1. Click the Action drop-down button in the Workflow tab toolbar and select the Log to History List option. Exercise - Custom Workflows
    2. Click the this message link within the workflow editor work area. Exercise - Custom Workflows
    3. Click the ellipsis button next to the log message text box to open the String Builder editor. Exercise - Custom Workflows
    4. Type "Time-Off request started for:" in the Name field then with you insertion point at the end of the line after the colon and click the Add or Change Lookup button. Exercise - Custom Workflows
    5. In the Lookup for String dialog box, leave the Data source field set to Current Item and select Name in the Field from source drop-down field. Exercise - Custom Workflows
    6. Click the OK button on the Lookup for String dialog to close and save your choices.
    7. Click the OK button on the String Builder dialog to close it and save the string.
  6. Add an action that will collect data from a user using a custom task.
    1. Hover your mouse pointer under the Log to History List action you created in the previous steps and click on the orange bar that appears. Exercise - Custom Workflows
    2. Type the word "collect" and the orange bar will change into a text box like the following image: Exercise - Custom Workflows

      This is just another way to add an action to a workflow. You could also use the Workflow tab's Action drop-down button like you did with the Log to History List action.

    3. Press your Enter key to have the editor add the Collect Data from a User action. Exercise - Custom Workflows
    4. Click the data link in the Collect Data from a User action to open the Custom Task Wizard dialog. Exercise - Custom Workflows
    5. Click the Next button on the first page of the Custom Task Wizard dialog.
    6. On the second page of the Custom Task Wizard dialog, change the Name field to "Time-Off Request Task" and click the Next button. Exercise - Custom Workflows
    7. On the third page of the Custom Task Wizard dialog, click the Add button to add a new field to the custom task. Exercise - Custom Workflows
    8. Type "Time-Off Response" in the Field name field and choose Choice (menu to choose from) in the Information type drop-down field and click the Next button. Exercise - Custom Workflows
    9. Type "Approved" and "Denied" on separate lines in the Choices field of the Column Settings dialog and click the Finish button. Exercise - Custom Workflows
    10. Click the Add button back on the Custom Task Wizard dialog to add a second field to the list. Exercise - Custom Workflows
    11. Type "Manager Comments" in the Field name field and choose Multiple lines of text in the Information type drop-down field of the Add Field dialog and click the Next button. Exercise - Custom Workflows
    12. Leave the Default value field blank and click the Finish button on the Column Settings dialog.
    13. Click the Finish button on Custom Task Wizard dialog to save the custom task.
    14. Click the this user link in the Collect Data from a User action to open the Select Users dialog. Exercise - Custom Workflows
    15. Select Workflow Lookup for a User... option within the list box and click the Add button on the Select Users dialog. Exercise - Custom Workflows
    16. Select Manager in the Field from source drop-down list field and click the OK button on the Lookup for Person or Group dialog. Exercise - Custom Workflows
    17. Click the OK button to close and save your choice on the Select Users dialog.
  7. Add an action that will retrieve the Manager Comments from the previous task action into the Manager Feedback field of the list item.
    1. Hover and click the orange bar below Collect Data from a User action. Exercise - Custom Workflows
    2. Click the Action button drop-down in the Workflow tab toolbar and choose the Set Field in Current Item action from the list. Exercise - Custom Workflows
    3. Click the field link in the Set Field in Current Item action and choose Manager Feedback from the drop-down list. Exercise - Custom Workflows
    4. Click the value link in the Set Field in Current Item action and then click the ellipsis button to open the String Builder dialog. Exercise - Custom Workflows
    5. Type "Request feedback from Manager: " in the String Builder field and then click the Add or Change Lookup button. Exercise - Custom Workflows
    6. Select Association: Task List from the Data source drop-down field. Exercise - Custom Workflows
    7. Select ID from the Field drop-down field. Exercise - Custom Workflows
    8. Click the fx button next to the Value field text box. Exercise - Custom Workflows
    9. Select Workflow Variables and Parameters from the Data source field drop-down list in the Lookup for Integer dialog. Exercise - Custom Workflows
    10. Select Variable: collect from the Field from source field drop-down list in the Lookup for Integer dialog. Exercise - Custom Workflows
    11. Click the OK button to save your choices and close the Lookup for Integer dialog.
    12. Select Manager Comments from the Field from source field drop-down list. Exercise - Custom Workflows

      The Manager Comments custom task field will not show in the list until you've completed the Find the List Item portion of the Lookup for String dialog. The Find the List Item portion is how the workflow retrieves the specific task that was created by previous workflow action.

    13. Click the OK button to close the Lookup for String dialog and save your settings.
    14. Click the OK button to close the String Builder dialog and save your string.
  8. Add a Set Workflow Variable action that store the Time-Off Response of the custom task action created in previous steps. The workflow variable will be used in later steps with a condition to send different emails based on the Manager's response in the custom task.
    1. Hover and click the orange bar below Set Field in Current Item action. Exercise - Custom Workflows
    2. Select Set Workflow Variable from the Action drop-down list in the Workflow tab toolbar. Exercise - Custom Workflows
    3. Click the workflow variable link in the new action and select Create a new variable from the drop-down list. Exercise - Custom Workflows
    4. Type "Response" in the Name field and select String in the Type field and click the OK button to close the Edit Variable dialog and save your settings. Exercise - Custom Workflows
    5. Click the Value link of the Set Workflow Variable action. Exercise - Custom Workflows
    6. Click the fx button next to the Value field text box. Exercise - Custom Workflows
    7. Select Association: Task List from the Data source drop-down field. Exercise - Custom Workflows
    8. Select ID from the Field drop-down field. Exercise - Custom Workflows
    9. Click the fx button next to the Value field text box. Exercise - Custom Workflows
    10. Select Workflow Variables and Parameters from the Data source field drop-down list in the Lookup for Integer dialog. Exercise - Custom Workflows
    11. Select Variable: collect from the Field from source field drop-down list in the Lookup for Integer dialog. Exercise - Custom Workflows
    12. Click the OK button to save your choices and close the Lookup for Integer dialog.
    13. Select Time-Off Response from the Field from source field drop-down list. Exercise - Custom Workflows

      The Time-Off Response custom task field will not show in the list until you've completed the Find the List Item portion of the Lookup for String dialog. The Find the List Item portion is how the workflow retrieves the specific task that was created by previous workflow action.

    14. Click the OK button to close the Lookup for String dialog and save your settings.
  9. Add an If any value equals value condition to the workflow.
    1. Hover and click the orange bar below the last action in the workflow. Exercise - Custom Workflows
    2. Select If any value equals value option from the Condition drop-down button in the Workflow tab toolbar. Exercise - Custom Workflows
    3. Click the value link in the workflow condition. Exercise - Custom Workflows
    4. Click the fx button next to the value text box. Exercise - Custom Workflows
    5. Select Workflow Variables and Parameters for the Data source field of the Define Workflow Lookup dialog. Exercise - Custom Workflows
    6. Select Variable: response for the Field from source field of the Define Workflow Lookup dialog. Exercise - Custom Workflows
    7. Click the OK button to close the Define Workflow Lookup and save your settings.
    8. Click the value link in the workflow condition and type "Approved", without the quotes, in the text box. Exercise - Custom Workflows
  10. Add a Send an Email action inside the If condition.
    1. Hover and click the orange bar directly below the label (Start typing or use the Insert group in the Ribbon). Exercise - Custom Workflows
    2. Select Send an Email from the Action menu drop-down button on the Workflow tab toolbar. Exercise - Custom Workflows
    3. Click the these users link in the Send an Email action. Exercise - Custom Workflows
    4. Click the User Lookup icon, looks like a book, next to the To field in the Define E-mail Message dialog. Exercise - Custom Workflows
    5. Click the Workflow Lookup for a User... option and click the Add button in the Select Users dialog. Exercise - Custom Workflows
    6. Select Created By in the Field from source drop-down list field of the Lookup for Person or Group dialog. Exercise - Custom Workflows
    7. Click the OK button to close the Lookup for Person or Group dialog and save your settings.
    8. Click the OK button to close the Select Users dialog and save your settings.
    9. Type "Vacation Request Approved" in the Subject field of the Define E-mail Message dialog.
    10. Type "Your vacation request has been approved" in the Body field of the Define E-mail Message dialog and click the OK button to close and save.
  11. Add an Else block to the If condition.
    1. Hover and click the orange bar below the Send an Email action. Exercise - Custom Workflows
    2. Click the Else-If Branch button on the Workflow tab toolbar to add an Else block to the If condition. Exercise - Custom Workflows
    3. Hover and click the orange bar directly below the Else label. Exercise - Custom Workflows
    4. Select Send an Email from the Action menu drop-down button on the Workflow tab toolbar. Exercise - Custom Workflows
    5. Click the these users link in the Send an Email action. Exercise - Custom Workflows
    6. Click the User Lookup icon, which looks like a book, next to the To field in the Define E-mail Message dialog. Exercise - Custom Workflows
    7. Click the Workflow Lookup for a User... option and click the Add button in the Select Users dialog. Exercise - Custom Workflows
    8. Select Created By in the Field from source drop-down list field of the Lookup for Person or Group dialog. Exercise - Custom Workflows
    9. Click the OK button to close the Lookup for Person or Group dialog and save your settings.
    10. Click the OK button to close the Select Users dialog and save your settings.
    11. Type "Vacation Request Rejected" in the Subject field of the Define E-mail Message dialog.
    12. Type "Your vacation request has been rejected" in the Body field of the Define E-mail Message dialog and click the OK button to close and save.
  12. Save the Time-Off Request WF workflow.
    1. Click the Save icon in the upper-left corner the SharePoint Designer window. Exercise - Custom Workflows
  13. Change the Time-Off Request WF to start automatically when a new item is added to the list.
    1. Click the Time-Off Request WF breadcrumb at the top of the workflow editor area. Exercise - Custom Workflows
    2. Check the Start workflow automatically when an item is created check box under Start Options. Exercise - Custom Workflows
  14. Publish the Time-Off Request WF workflow.
    1. Click the Publish button on the Workflow Settings tab toolbar. Exercise - Custom Workflows
  15. Create a new item in the Time-Off Requests list to test the custom workflow.
    1. Switch back to your browser window or open one if you don't have one already open and browse to your site.
    2. Click the Time-Off Requests link in the site's Quick Launch menu.
    3. Click the new item link in the list. Exercise - Custom Workflows
    4. Enter the following information in the Time-Off Requests- New Item dialog and replace the Name and Manager fields with your account:
      Name SP_Admin
      Start Date Select the following week's Monday
      End Date Select the following week's Friday
      Reason Going Fishing
      Manager SP_Admin
    5. Click the Save button to save the new time-off request item.
    6. Click the Time-Off Requests link in the site's Quick Launch menu to refresh the page.
    7. Verify the column Time-Off Request WF has been added and the status for the new list item is In Progress. Exercise - Custom Workflows

      Until the task created by the workflow is completed, the workflow will remain In Progress. Once the task is completed, the workflow will continue to the next action defined in the workflow.

  16. Complete the Time-Off Request WF custom task.
    1. Click the Site Contents link in the site's Quick Launch menu.
    2. Click the Tasks link on the Site Contents page.
    3. Click the Time-Off Request Task link to open it. Exercise - Custom Workflows
    4. Select Approved in the Time-Off Response drop-down field and type "Of course, you can have all the time off you want!" in the Manager Comments field. Exercise - Custom Workflows
    5. Click the Complete Task button to complete the task and continue the workflow.
  17. Verify the Time-Off Request WF custom workflow has completed.
    1. Click the Time-Off Requests link in the site's Quick Launch menu. Exercise - Custom Workflows
    2. Verify the Manager Feedback column includes the Manager's comments and the Time-Off Request WF column status is Completed. Exercise - Custom Workflows
    3. Click the Completed link in the Time-Off Request WF column to view the workflow history.
    4. Verify the Log to History List action in your workflow added the custom message to the history log. Exercise - Custom Workflows
  18. Verify the email was sent.
    1. Open Microsoft Outlook.
    2. Open the email message from your site with the subject of Vacation Request Approval and verify the body matches what you configured in the workflow. Exercise - Custom Workflows
    3. Close the email message and close Outlook.
Next