Objective
Create an activity for checking if a user has a manager or not.
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.
Workflows > Activities
Workflows > Applications
And click the Ok button.
Expand the Developer Packages folder, find the DemoLabs folder, expand it under the DemoLabs folder, expand the Workflows, right-click on the Activities folder, hover your mouse on the New Activity option and Click on Flow Chart Activity.
Wait for the Activity designer to be loaded.
Once the Activity Designer is loaded, go to its properties tab, and from there, search for the System Code Activity. Then, drag and drop it onto the Activity Designer pane.
Now, draw lines to connect your activity with the starting and ending circles. Refer to the image below. and in the Name property give any name say SCActivity
Now, go to the Properties tab of your Activity Designer and create two properties: TargetPerson and TargetManager. The type of TargetPerson should be Person component, and the type of TargetManager should be string.
Now go to Activity Designer tab and double click on the SCActivity and it will generate a class for you and in that class, we have the Implement method write below code in it.
Code Block if (CurrentWorkflow.TargetPerson.ManagerPersonID != null) { CurrentWorkflow.TargetManager = "Yes, Person has a manager"; } else { CurrentWorkflow.TargetManager = "No, Person has no manager"; }
Now, click on the Save button at the top to save your activity and name it PMmanager. Once Save Click on the Publish button to publish your 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 Training_ActivityWF.
Once saved, drag and drop your Activity onto the designer pane of Workflow.
Keep the activity selected. If not selected, then select it, and on the right-hand side change its (Name) property to pMmanager1 and its Description property to Find current person manager.
Now click on the start circle, drag the line from it, connect it with your pMmanager1 and similarly connect the lines that will come out from your activity to the End circle.
Now, go to the Workflow properties tab and create a property named HasManager of type String.
Now go to Workflow Designer tab right click on your Activity (pManager1)
Now click on the publish button to publish your workflow; a dialog box will appear. Click on the Next button twice. Once saved successfully, click on the Ok button.