Wayfast Workflows
Overview
This tutorial outlines the steps to create and configure a two-step workflow.
Getting Started
Creating the Solution and a Project
On the My Solutions page, click the “New Solution” button.
Figure 1. Create a new workflow Solution
Supply a meaningful solution name and description, then click “Submit.”
Figure 2. Naming your workflow solution
Activate your new solution on the “My Solutions” page by clicking on the solution’s name. This will bring up your solution’s projects page.
Figure 3. Solution projects page
Creating a Project
Click on the “Project” button to create a new project. Supply a meaningful name and description. For “Project Type,” select “Workflow” from the dropdown. For this demonstration, you can select “SSO” as the project’s “Login Type.”
Figure 4. Workflow project parameters
Save your work by clicking “Submit.” Wayfast then displays the skin selection screen.
Figure 5. Selecting a project skin
Once you have selected at least one skin, scroll down to the bottom of the page and click “Assign.”
Figure 6. Skin assignment button
When Wayfast returns to the projects page, you should see your newly created workflow project.
Figure 7. Solution project page with new project
Creating a Task for Your Workflow Project
Workflow projects – like every other Wayfast development activity – require an active ticket. After activating the project (i.e., after clicking the project name “Workflow Demonstration Project”), create a ticket for the project. Click on the "Requirements" button on the top menu.
Figure 8. Accessing the requirements screen
Once the requirements screen appears, click the “New Requirement” button.
Figure 9. Clicking the New Requirement button
In the “New Requirement” screen, select “Enhancement” as the “Requirement Type.” Supply a title and other explanatory information. After completing the remaining optional data elements, scroll to the bottom of the screen and click the “Submit” button.
Figure 10. Selecting "Enhancement" as Requirement Type
Now that you have created a new ticket, activate it by selecting the ticket in the panel on the left side of the screen and click “Activate Task.”
Note: in the event you have an active ticket, you will first need to end the active task and then activate the new ticket.
Figure 11. Activating your new ticket
Associating a Database to a Workflow Project
Next, we are going to associate a database with the project. Click on the "Database" button on the top menu.
Figure 12. Clicking the database button
Then click the “Instances” submenu.
Figure 13. Activating the instances submenu
Next, click “Associate Instance.”
Figure 14. Selecting Associate Instance
Select a database server instance (by IP address or UNC name) and click “Submit.”
Figure 15. Associating a database instance
Upon returning, the screen displays the newly associated database instance.
Figure 16. Database instance listing
Next, click on the “Database” submenu.
Figure 17. The Database submenu
Click on the Database submenu. Here we have the option to “Create” a new database or “Attach Db” an existing one. Typically, you will create your own set of database objects to control the flow of your workflow. For demonstration purposes, we are going to associated to an existing database by clicking on the “Attach Db” button.
Figure 18. Clicking the Attach Db button
After the “Associate Database” pop-up window opens, select the appropriate database server instance.
Enter “WKF_Demo” with the “Database” field and click on the magnifying glass button to find the demonstration workflow database and select the value within the presented drop down list. Close the popup by clicking “Submit.”
Figure 19. Attaching to a database
Wayfast now returns to the database listing screen.
Figure 20. Database listing with attached database
Configuring Workflow Roles & Steps
The actions undertaken to this point are common to both normal Wayfast projects and workflows. To configure a workflow, click on the “Workflow Options” button on the top menu.
Figure 21. The Workflow Options button
Next, click the “Workflow Roles” submenu.
Figure 22. The Workflow Roles submenu
Here we must create the roles that are going to be performed in the workflow. In this example we are doing a two-step workflow, keep in mind that the workflow starts with a normal form that triggers a workflow, that first form does not require the creation of a role, it is from the next step within the workflow that the use of a role is required.
Creating a New Workflow Role
Figure 23. Clicking the Add role button
Start off by clicking the “Add” button. The “WKF Roles” pop-up screen will appear.
Figure 24. The WKF Roles popup
Name your role “ConfirmRole,” then select the “Type Resolution” dropdown menu. This dropdown displays three options:
· SQL Function (UserId)
· SQL Function (Email)
· Email by Parameter
Workflows typically use the SQL function that returns an email. But for demonstrations purposes we will choose “Email by Parameter”. After choosing this option one field will appear: a field to enter the parameters. Double-click the "Parameters" field and add a valid email address surrounded by single quote marks and followed by a comma.
Submit these changes to complete the role configuration.
Figure 25. Updated Workflow Roles listing
Creating Workflow Pages
Click on the on the “Project Pages” button on the top menu.
Figure 26. The Project Pages button
After the project pages listing appears, observe that this project lacks page layouts.
Figure 27. Project pages without a layout
Click on the “Please assign Layout to create a New Page” link. This brings you to the layouts listing page where you can click on the “Add Layout” button.
Figure 28. Adding layouts to a project
On the resulting screen, select one or more layouts, making sure to include “popup.html.” Return to the “Project Pages” page and click the “New Page” button.
Figure 29. Clicking the New Page button
On the new page creation pop-up window, fill in the following elements: In the “Name” and “Description” fields, enter “Workflow1.” In the “Type” dropdown, select “WKFInit.” Note: the initial workflow page is always of type “WKFInit.” Select “popup.htm” from the “Layout” dropdown. Check “Is Initial Page.” Click “Submit” to complete the creation of the page.
Figure 30. Creating the home page
Follow up by creating a second page as follows: “Name” and “Description” are “Confirmation.” Type is “WkfTask.” “Layout” is “popup.html.” “Task Type” is “Normal.” Note: the “Virtual” “Task Type” option is used to launch a workflow or a stored procedure. Virtual tasks do not require configuration of a visual screen and are generally used in the final steps of a workflow. Finally, “Role Of The Task” is “ConfirmRole.”
Figure 31. Configuring the confirmation page
Submit the form.
Configuring Workflow Pages
Now we are going to configure the pages. Click on the name of the home page, “Workflow1”.
Figure 32. Workflow page listing
Expand the “General Information” control and verify that the checkbox, “Is initial Page” is selected and the “Type” dropdown dipslays “WKFInit.”
Figure 33. Verifying General Information settings
Create a label control to identify that we are on the first page of the workflow. Click on the “Controltype” dropdown, select “LABEL” followed by a click on the “New” button. In the configuration pop-up window, enter “lblTitle” for the “Object Name” and “INIT WKF” as the “Displayed Name.” Activate the Layout tab, select a Place Holder and enter “1” in the “Order” field. Click “Submit” to complete the configuration.
Next, configure a button to trigger the next step of the workflow. As with the label, click on the “Controltype” dropdown and select the “BUTTON” option, then click on the “New” button. The button configuration pop-up window will open. Keep in mind that in these pages we can add any control we need, for example, an INPUTBOX control that helps us to save information in the database, but in this example we are only going to add this button that allows us to go to the next step of the. In the “Object Name” field we are going to enter “btnSubmit.” Then in the field "Displayed Name," enter "Submit." The next step is the most important since we are going to indicate that we are starting the workflow. In the “Home / End Wkf” dropdown select the “Start” option and in the “Flow Wkf” dropdown, select the default (“YES”). We configure this like this because in this example we are creating a two-step workflow, if this were a workflow with more steps and we were configuring an intermediate step, in the "Home / End Wkf" dropdown we should leave the default value and in the field "Flow Wkf" we should select the “YES” option, this would allow us to visualize this new field, "Flow workflow" where we would select the workflow that follows.
Figure 34. Configurating workflow options
We now go to the layout tab, select a placeholder and in the "Order" field we enter 2, then click on the “Submit” button. Next, save your work by clicking “Submit.” This will leave you with the screen
Figure 35. Controls added to Workflow1
We now have the initial form configured. Now we are going to configure the next workflow, which is the confirmation workflow. From the “Project Pages” we click on the Confirmation task.
Figure 36. Confirmation Step
In this window we will first add a Label control, click on the “Controltype” drop-down menu and select the “LABEL” option, then click on the “New” button, the label configuration pop-up window will open. In the “Object Name” field we enter “lbltitle”, in the “Displayed Name” field, we enter “Confirm”. We click on the Layout tab and select a Placeholder and in the “Order” field we enter 1, then we click on the “Submit” button to complete the configuration of the control.
Next, we are going to create a button that will end the workflow. We click on the “Controltype” menu and select the “BUTTON” option, then click on the “New” button. The button configuration pop-up window will open. In the “Object Name” field we enter “btnEnd”, then in the “Displayed Name” field we enter “End”. As this is the last step of the workflow, in the “Home / End wkf” drop-down menu we select the END option. This will end the workflow. In the “Flow wkf” drop-down menu we select NO. We click on the Layout tab and select a Placeholder, in the "order" field we enter 2. We return to the "General” option tab and click on the "Submit" button.
So far, we have already configured the two forms. Now we need to finish configuring the workflow.
Figure 37. Confirmation controls added
For that, we are going to click on the "Workflow Options" button on the top menu and then click on the "General Information Workflow" submenu. Here we must configure four things: Mail_ID, Start Task, Workflowtype and Webserver.
The Mail_ID defines which email template is used that will reach the user who has the assigned role and the "Start Task" which is the initial step of the workflow. We go to the Mail_ID search field and select the option "Workflow_processF5" which is a generic template that we have available.
Then we go to the "Start Task" search menu and select the form we are using, we can see that in this case we have only one to choose which is "Confirmation", because for this example we only created a second step. in case If the workflow had more steps, we must choose the form corresponding to the immediate step that we configured as Init.
Next, in the “Workflow Type” drop-down menu, we select the “New Request” option.
Finally, we go to the "Webserver" field, as for this example we do not need a specific port, we are simply going to delete the port in this field and with this we complete the configuration of this workflow. We click on the “Submit” button to save the configuration.
Figure 38. General Information Workflow
We can now define the subject and content of the “Confirmation” email. That can be done by selecting the “Tasks Of A Workflow” sub-menu option, or by simply clicking the main “Workflow Options” element in the top menu. From here simply click on the “Confirmation” link within the “Description” column and it will open a window where you can define the various elements of the Task and the email definition. It will default the Mail_ID to what is defined within the “General Information Window” and preselect the Role.
At this point we should check that the workflow is configured correctly. We click on the “Project Pages” button and if we click on the name of the initial page (Workflow1) and then click on the "Preview" button, it will show us the page, but it will not work. If we click on the “Submit” button, it will not perform any action.
To be able to do the test, it is required to trigger the initial Workflow1 page from within another project. This is accomplished through calling a specific Wayfast endpoint. Let us create another project and page that can generate that link for us.
We will need to run through the same steps as we did earlier while creating this workflow project. Which includes creating a new requirement for the new project, thus allowing you to create a new page. Except for this “Project Type” we will be choosing “Application” instead of “Workflow”. Give the project an appropriate unique name and select “Submit” to save the new project.
Figure 39. Creating Test workflow project page
After creating the new project, you will need to create a new requirement and activate that task before you can make any changes to the new test project. When selecting the layouts for this new project, make sure you select “simple.htm”. To simplify the process of building the workflow link to start our workflow, we are going to use a few controls from another project to help build our test page.
This new test project does not require the use of a database, but only requires the creation of a page. For this demonstration, a “TestWorkflow” page was created.
Figure 40. Test Workflow page created
Enter the “TestWorkflow” page, and we can then import the controls from another project so we can test our workflow.
After loading the "TestWorkflow” page, click on the button “Imp. Controls” to bring up a screen where you can import controls from another project. Within the “Projects” control, type “WKF_Demo” and select the entry from the drop-down list. This will display the value “Workflow DB Resource” in the Projects field. You should be able to select the magnifying glass in the “Page” control to see the option “WorkflowList”, select that option and select “Continue” to see all the controls listed on that page.
Figure 41. Import Controls page
Click on “Select All” to select all the controls in the list, and then select “Import”. This will copy all these controls into your new TestWorkflow page, allowing any necessary modifications to be made against these controls.
Figure 42. After importing controls
We will need to make just one change to the imported dataset to allow our workflow to be tested. Edit the dataset “DSGetWKFMeta” by clicking on the magnifying glass. Navigate to the “Data Binding” tab and click the “X” on the second parameter so it is removed. Double-click on the parameters control where the second parameter used to be located. We need to enter in our workflow project name, which is ‘Workflow_Type_Project’ (including the single quotes) followed by a comma and the Escape key. Select the “Submit” button to save the new configuration.
Now we can preview the workflow. We click on the “Preview” button, this will take us to the “Admin Module”. Here we can see that we have a hyperlink to call the workflow, we click on it and the “Init wkf” pop-up window will open. This is the initial page that we set up in our workflow.
Figure 43. Test Workflow Preview
By clicking on the “Link”, you should see your initial workflow page appear along with the “Submit” button”.
Figure 44. Initial Workflow Page
We click on the “Submit” button and this takes us to a workflow response window indicating that step one is complete. What the workflow does internally is look for the email of the user with the assigned role and send him the link of the next step so that he can continue with the flow.
Figure 45. Completion response to Step 1
Next, the user with the assigned role must go to his email manager and wait for the email with the link to arrive. This may take a couple of minutes. This process is done automatically by the workflow.
Figure 46. Workflow Email
Here we can see that the user received the mail. In this case, the body of the email is blank, but this can be configured and the body of the message can contain what we consider necessary. We click on the link and this should return us to the second step that we have configured in our workflow, the confirmation step that consists of a page labeled “Confirmation” and a button called “End” to end the workflow.
Figure 47. Workflow Confirmation
For this example we only use two steps, in this case we have a button that terminates the workflow, but we can nest as many steps as we need, controls to enter information, another button that allows us to reject a previous workflow action or any action we need incorporate into the workflow. We click the “End” button and we get a message back indicating that this step has already been completed, which, as it is the last one, also ends the workflow. Because this is the final step we set up, this doesn't trigger any other actions or mailings, this is where the flow ends.
Figure 48. Workflow completed
In this way we conclude this tutorial on how to create and configure a workflow within our WayFast project.
Workflow Link Creation
You can view the SQL used to create the link by clicking on the dataset’s “See Script” magnifying glass. It simply looks up your workflow record from the Wayfast table called “workflow_workflow” and properly formats its content into a clickable link.
Identifying Errors
There may be times where an error is encountered while defining your workflow/Wayfast projects. You can use the following SQL to help identify the underlying cause. Simply replace “workflow_type_project” with the name of your project and the last 50 entries will be returned.
You may also want to review the various configuration steps to ensure everything was saved correctly.