Creating a Wizard with Workflows 2/2

Last post we looked at creating a new table and workflow items to support a workflow driven wizard. Now lets take those items and create a full workflow with a corresponding page.

Create a new page, it can be any type but I like to use card type as it lets you hide and show sections a lot easier. On this page make a few sections. You will also need to add in a variable to know what section is to be shown. As well as a variable for our new wizard table. For each section set the visible based on the value of the new integer variable. Make at least 3 sections so you can see how to control the flow from the workflow.

pagedesign

Next we have to add in code to the onOpen trigger. This will start the workflow off and get a bunch of values setup. The next bit of code will be in the OnAfterGetCurrRecord trigger. This will refresh the current step variable which will in turn hide and show the appropriate sections. Lastly we need the action to advance through the workflow.

Pagecode

The page is all set up. Now lets create the workflow. Our first step is the page open step. We need to set a filter for this step. This filter is the page ID. The reason for this is because if we have multiple wizard like pages, the same workflow will get used for all of them. This way we can set up different workflows for different pages.

The response to this step will be to set the current section. The parameter should show up so you can select the section you want.

Stepselection

The next few rows of our workflow will be as follows: The event step will be when the next button gets pressed. The response will be setting the current section. Do this for as many sections you want your workflow/wizard to go. You can even go back to previous sections if you want.

workflow

The only big issue is there is no way to back track through the workflow. Workflows don’t work well when you want to go backwards.

Now that the workflow is setup. Enable it. And run the new page. Hopefully you should get something like below:

action

Leave a Comment