Objective
Create two User Decision Forms:
Use the first form to select a person for leave approval.
Create the second form for the approver to approve the leaves.
Credentials:
User ID: Test
Password: P@$$w0rd
Start the 20331B-NYC-DC-05 virtual machine. Wait for the virtual machine to display the Desktop.
On your Desktop, Right-click Workflow Studio (WFS), and then click Run as administrator.
Wait for WFS to start and enter your credentials.
In Solution Explorer, right-click on the Developer Packages folder, create a new folder called DemoLabs, and click the Ok button.
Add New Folder dialog box will appear from it; select the following options
User Interface > Lookup Control
User Interface > Forms
User Interface > UI Pages
Workflows > Applications
And click the Ok button.
Expand the Developer Packages folder, find the DemoLabs folder, expand it under the DemoLabs folder, expand the User Interface folder, right-click on the Forms folder, hover your mouse on the New User Interface option and Click on Form.
Wait for the Form designer to be loaded.
After loading the Form Designer, navigate to the Properties tab. From there, change the 'Form Type’ to UserDecision and set 'ShowComments' to True
Click on the Save button to save your Form and give it the name VacationRequestForm.
Give your section name Vacation Request
Right-click on the Form Data then click on Add Object and go to Rbac Components tab from there select the Person component and click on Add button.
Double-click on Person1 and rename it to TargetApprover only.
Now expand the TargetApprover and drag and drop the PersonID (Rename it to Approver’s Name)
Next, right click on the Approver’s Name text box then click on the Edit option. This action will open the Field Configuration dialog box. From there go to Control Types tab and choose the PersonAutoComplete control. Now proceed the Standard Properties tab and check the Enable Dialog and Populate Autocomplete Object checkboxes and click on the Ok button.
Now your form will resemble the image below.
Publish your Form. After publishing, allow the Workflow Studio to restart. This will generate a Form Activity.
On your newly created Form go to the Properties tab. From there, change the 'Form Type’ to UserDecision and set 'ShowComments' to True
Click on the Save button to save your Form and give it the name VacationApprovalForm.
Give your section name Requestor Info
Now go to Approval Decisions and from there enable the Approved and Rejected buttons.
Right-click on the Form Data then click on Add Object and go to Rbac Components tab from there select the Person component and click on Add button.
Double-click on Person1 and rename it to TargetRequestor only.
Now expand the TargetRequestor and drag and drop the following fields/columns on the Form Designer.
FirstName
Last Name
Email
Friendly Name
Company
Title
Now right click on all the fields one by one and set IsRead only.
Now your Form will look like this one in the below image.
Publish your Form. After publishing, allow the Workflow Studio to restart. This will generate a Form Activity.
Expand the Developer Packages folder, find the DemoLabs folder expand it under the DemoLabs folder, expand the Workflows folder right click on the Applications folder, hover your mouse on the New Workflow option and Click on Flow Chart Workflow
Wait for the Workflow Designer Pane to be loaded. Once loaded, click on the save button to save your workflow.
Give your workflow a name in this case RequestVacationWF.
Once saved, drag and drop your Form control activity onto the designer pane of Workflow.
First drag and drop the Vacation Request Form and then Vacation Approval Form onto the designer pane of Workflow.
Select the Vacation Request Form, and in its Name property, write RequestVacationForm. In its 'Description property, write Request Vacation.
Select the Vacation Approval Form, and in its Name property, write ApprovalVacationRequestForm. In its Description property, write Approval Form.
Right-click anywhere on the Workflow Designer pane and select the 'Workflow Business Rules' option. This action will open a Workflow Business Rules dialog box. In the Name textbox, enter IsDecisionApprove_Rule and click the Add button.
Now double click on the IsDecisionApprove_Rule, and it will generate a class. Go to its Evaluate method and write the below code.
Code Block return CurrentWorkflow.ApprovalVacationRequestForm.FormDecision == E.BusinessProcessTaskSlotResponseTypeList.Approved;
In the above code, ensure that you provide the name of your Form. In my case, the name was ApprovalVacationRequestForm. If it had been different, I would have used that name.
Now that we have both Forms and Business Rule on our workflow designer pane, it's time to connect them with lines. Connect them with lines as shown in the image below.
Select the line coming out from the bottom of second Form Activity, right-click on it, and choose Select Line Rule. From the Select Rule dialog box, select the rule we have created and click the OK button.
Repeat the same process for the line coming out from the left of your second activity. But this time, after selecting the rule, also check the If Rule Not True checkbox and Click Ok button.
This is how your workflow will look. Please refer to the image below.
Now it's time to perform the binding so that we can transfer data from our first form to the second form, and in case of rejection, pass the data back to the first form.
First pass the initiator of workflow to the DesignatedPersonApprover property our first form which is RequestVacationForm then in the DesignatedPersonApprover property of your sec