Workflow Tutorial: Advanced Workflow Pause
Sometimes you just need to take a break. Get away from it all. The purpose of this tutorial is to learn how to create a project which can be paused and resumed at will.
Objective: To learn the Pause Execution WorkFlow component and its features.
Estimated time to complete: 30 minutes
Step 1: Create a New Project
Create a new Workflow project:
Step 2: Create Your New Model
Drag and drop the Approval Workflow and the SelectValueWorkflow components from your toolbox. These components are located under the Workflow Components category.
Click on the Input Data entry in the Project Info box. In order for your project to work properly, you must specify input data for the project to work from. Set the Input Data as shown below:
Create a new input variable by clicking on the Add button. Set its Name to "RetValue" and its Data Type to "Text."
Step 3: Edit Your Added Components
Right click on the SelectValueWorkFlow component and select Edit Component. Select the Event Configuration tab and click the ... button next to the Start Process field. The Edit Embedded Decision Model window appears.
Add a SendMail component to your project by dragging it from the Communications category of your toolbox.
Right click on the SendEmail component and choose Edit Component. Click the ... button to the right of the ToAddresses field. In the Constant Data tab, unclick the NULL checkbox, and enter an email address in the Value field. Repeat this process for the From Address field.
Enter "Leave Application" into the Subject field.
Click the ... button to the right of the SMTP Server Name field in the Email Settings tab. In the Constant Value tab, unclick the NULL button, and enter "localhost" into the Value field. This sets the SMTP server as the computer running the project (e.g. the "local" host.)
Click on the ... button next to the Contents field. The Advanced Text Creator window appears. Drag and drop the ResponsePageLink in the Design View as shown below.
Step 4: Finishing the Main Model
Click the OK button in the Edit Embedded Decision Model window to return to the main model window:
In the Edit Component window, select the Response tab. Set the values to the Button Text to "Yes" as shown below. Set the Selection Output Variable Name as "RetValue".
In the Edit Component window, select the Setup: Page Look tab and click the selector button next to the Item Description field.
Type the Item Description in Design View tab as shown below. Click OK to accept changes.
Still in the Setup: Page Look tab click the selector button next to the Responses field. Select the Constant Data tab and add "Yes" and "No". Click OK twice.
Add an EqualsRule component to your project. This component is located under the Rules category of your toolbox. Right click the EqualsRule component and select Edit Component. Set the Data Type as "Text". Set the Variable Name as 'RetValue'.
Click the ... button to the right of the Compare To field. In the Constant Value tab, unclick the NULL checkbox and enter "Yes" in the Value field. Click OK twice.
Add a new PauseExecutionWorkflow component from the Workflow Components category of the toolbox and link all components in the model as shown below:
Right click on the ApprovalWorkflow component and select Edit Component. In the Setup: Page Look tab, set the Item Description as "Leave Application". Click OK.
Right click on the PauseExecutionWorkflow component and select Edit Component. Click the ... button next to the Pause Time field. Click the box next to Allow End Time To Fall Outside Business Hours and set the Time Span as shown below. Click OK twice.
Step 5: Test The Project
Save your project and click the Debug button (located on the toolbar). Double-click on the "MyService.asmx" link located on the left-hand side of the debug window.
Enter "Test" as the initial value for the "RetValue" variable.
You will soon receive an email from your project. In the email, there will be a "Respond" link. Click on this link. The following Internet browser window appears. Select Yes and click the Yes button.
Another window appears. Click the Close button.
When the PauseExecutionWorkflow component is reached, your project execution will be temporarily paused:
Select the Workflow tab at the bottom of the window and click the Refresh Now button. The execution will now restart.