2.2 Creating the Virtual Machine Request Approval Workflow
Each of the following subsections creates the different stages of the workflow.
Creating the Workflow and Initial Stages
To create the Virtual Machine Request Approval workflow, perform the following steps:
1. Open your site in SharePoint Designer 2013 (SPD).
2. From the navigation pane, click Lists and Libraries.
3. Find the Virtual Machine Requests list you created in the previous section, and select it.
4. From the
Ribbon, click the List Workflow button. This will create a new workflow
that is associated with the list. The key limitation of this type of
workflow is that it cannot be reused.
5. In the Create List Workflow dialog that appears, enter Virtual Machine Request Approval for the name of the workflow.
6. Enter a brief description, if desired.
7. Ensure that
the SharePoint 2013 Workflow option is the selected Platform Type, and
click OK. After the new workflow has been created, SharePoint Designer
will display an empty stage, as shown in Figure 2.
SPD uses stages to model the steps in a business process. You can use
the Condition and Action buttons on the Ribbon to define the different
checks and actions during the workflow process.
8. Click the number 1 to the right of Stage, and a text box will appear in which you can rename the stage. Rename it Start, and press Enter.
9. From the
Ribbon, click the Stage button to insert a new stage. If the Stage
button is grayed out, click the Stage: Start banner to enable the Stage
button.
10. Rename the new stage In Review.
11. Create the following stages using the same process, and be sure to save your work when you are done:
- Approved
- Deployed
- In Triage
- Rejected
- Cancelled
- Finished
Configuring the In Review Stage
Recall that during the In Review stage,
a task to approve the request is assigned to the Operations Managers
group you created in previous steps. If a person in this role approves
the request, it moves to the Approved stage. Otherwise, the request
moves to the Rejected stage.
1. Hover your mouse over the stage In Review until you see a thin, horizontal orange bar.
2. Start typing the words
Set Work, and then press Enter. As shown in Figure 3, select Set Workflow Status from the drop-down menu to insert the Set Workflow Status action.
NOTE You can also insert workflow actions from the Ribbon by clicking Action and choosing the desired workflow action.
3. In the Set Workflow Status action, click the hyperlink labeled “this message” and enter the following text: In Review. Now that you have set the status of the workflow, you will create a new task and assign it to the Operations Managers group.
4. Hover your
mouse over the stage In Review until you see a thin orange bar under
the Set Workflow Status action you created in the previous steps, enter
the word Start, and then press Enter.
From the four items on the menu, select “Start a task process,” which
will insert the Start a Task Process workflow action.
5. In the
Start a Task Process action, click the hyperlink labeled “these users.”
This will launch the Start a Task Process dialog.
6. To specify
the Participants for the task process, click the ellipses (...) to
launch the Select Users dialog. Find the Operations Managers group,
click Add, and then click OK.
7. Type New Virtual Machine Request for the Task Title.
8. Under the Description text box, click the “Open editor for body” button. This will launch the String Builder dialog.
9. In the text box, type Please approve the virtual machine request for. Insert the caret after the text “for” and click Add or Change Lookup. This will launch the Lookup for a String dialog.
10. You need
to complete the different options to perform the data lookup, so
configure the Lookup for String dialog as follows, clicking OK when you
are done:
- Data Source — Select Current Item.
- Field from Source — Select Requested By. Note that this was one of the custom columns you added previously.
- Return Field — Select Display Name.
11. That completes the Start a Task Process configuration, so you can click OK.
12. Create a
new variable called ApprovalOutcome by clicking the Variable:Outcome
hyperlink and choosing the Create a new variable... option. Click OK.
Now it is time to determine the outcome of the task and the next stage.
13. Hover your
mouse over the stage In Review until you see a thin, orange bar, and
click the bar. Then click the Condition button on the Ribbon and choose
the “If value equals value” option.
14. The condition statement includes two different value options, both of which are actually hyperlinks. Click the first hyperlink that is labeled value, and it will launch the Define Workflow Lookup dialog. If the dialog doesn’t open, click the fx
button. Select Workflow Variables and Parameters for the Data Source,
and for Field from Source, select Variable: ApprovalOutcome. Click OK
when you are done.
15. Click the second hyperlinked that is labeled value, and choose Approved from the menu.
16. Within the
If branch, hover your mouse until you see the thin orange bar, and
click the bar. From the Action button menu, choose the “Go to a stage”
option.
17. Within the Go to a stage action, click the “a stage” hyperlink, and select Approved.
18. Add a Go
to a stage action to the Else branch. Within the Go to a stage action,
click “a stage” and select Rejected. At this point, the In Review stage
should resemble Figure 4.
Hopefully that wasn’t too painful, and by now you
should have the basics down. The next sections are much briefer, as the
concepts are very similar.
Configuring the Approved Stage
During this stage, a task to approve
the request is assigned to the Operations Managers group you created in
previous steps. If a person in this role approves the request, it moves
to the Deployed stage. Otherwise, the request moves to the In Triage
stage.
1. Insert a Set Workflow Status action and choose Approved from the menu as the status value.
2. Insert a Start a Task Process action. This is the task that will prompt the Operations Team to deploy the new virtual machines.
3. Under Transition to Stage, insert an “If value equals value” condition.
4. Configure the If branch to go to the Deployed stage if the DeploymentOutcome variable equals Approved.
5. Configure the Else branch to go to the In Triage stage. The completed stage should resemble Figure 5.
Configuring the Deployed Stage
In this stage, the status of the
workflow is changed to reflect the current stage, and an e-mail is sent
to the requestor to notify them of the request’s status. The workflow
then moves to the final stage, which is Finished.
1. Insert a Set Workflow Status action, and enter Deployed as the status value.
2. You need to
notify the Requestor that the request has been deployed. Insert a Send
an Email action, and configure the e-mail to be sent to the User who
created the current item, notifying them of the deployment.
3. Under
Transition to stage, configure the workflow to go to the Finished
stage, and save your work. The completed stage should look like what is
shown in Figure 6.
Configuring the Rejected Stage
In this stage, the status of the
workflow is changed to reflect the current stage, and an e-mail is sent
to the requestor to notify them that the request for virtual machines
has been rejected. In the e-mail, the manager will have outlined the
reasons for the rejection. The workflow will then move to the Finished
stage. Once your SPD entries are made, your complete Rejected stage
should resemble what is shown in Figure 7. Be sure to save your work.
Configuring the In Triage Stage
In this stage, the status of the
workflow is changed, and an e-mail is sent to the requestor to notify
them of the current stage of the request. The workflow is in this stage
because of issues encountered during provisioning of the virtual
machines. Therefore, a task to resolve any issues, and approve the
request, will be assigned to the Operations Team group you created in
previous steps. If the issues are resolved and the request is approved,
the request moves to the Approved stage. Otherwise, an e-mail is sent
to the requestor informing them that issues associated with their
request could not be resolved, and the workflow moves to the Cancelled
stage. The configured In Triage stage is shown in Figure 8. Be sure to save your work.
Configuring the Cancelled Stage
As you have done in every other stage,
the status of the workflow is changed to reflect the current stage. You
send the requestor an e-mail to notify them of the stage of the
request, and this time you should notify (cc:) the Operations Managers
and the Operations Team members as well. You could include an
explanation regarding why the workflow has completed unsuccessfully, at
least from the requestor’s point of view. The workflow then moves to
the final stage, which is Finished. Your completed stage should
resemble what is shown in Figure 9. Be sure to save your work.
Configuring the Finished Stage
This simple stage merely provides a
reusable and consistent exit mechanism from the workflow. You could
also use the Log to History List to write any information you would
like to the history information of the workflow. The completed stage is
shown in Figure 10.
Configuring the Start Stage
You thought we forgot about this one,
didn’t you? To begin the process, you notify the requestor that the
request has been received, and then you proceed to the In Review stage.
Although this stage may not seem very useful, you could use it for a
number of purposes, such as writing information to the history list or
to a separate list to ensure that the information is retained
long-term. The completed stage is shown in Figure 11.
You can also configure your workflow to start
automatically when a new list item is created. To do so, select the
Workflows tab, click the Virtual Machine Request Approval link, and
enable the check box “Start workflow automatically when an item is
created.” Be sure to save your work and publish your workflow. You can
test your new workflow by creating a new list item and watching the
process as each stage is approved or rejected.
This completes the process for creating
your custom workflow using SPD. It should have given you a feel for
what is involved in modeling a business process with an SPD workflow.