Next page and previous page logic for Wizard

0
Hi! I am in progress of making a wizard with different modules (eg. Loan, Funds, Mortgage). The user will be able to tick beforehand what modules to go through. If a module is ticked, then all the pages inside the module will be skipped in the wizard.   Say it will be 20 pages total in the wizard. Then I obviously could make a solution with 20 different “Go_to_next_page” microflows and then also 20 different “Go_to_previous_page” microflows. In the microflows I could handle all data, do a check before each module if the module should be skipped or not. However this seems a bit messy.   I am instead thinking of making an entity “WizardPage” to track what module the user currently is on and what step he is on in that module.   I have started created  a microflow  depending on what module the user currently is in and will expand this to track what step he is on in that module.   Microflow if user should skip a module and go to next one (Will be necessary to check at the start of each new module in the wizard)   Wizard looks like below with the modules on the top and then I will implement another  wizard within each module to track the steps within the module. Right now I am thinking if this is the way to build this logic. I want it to be easy to add a new module to the wizard if necessary. And skip modules if wanted. Also each module might have different data objects.   But I am a bit stuck on how to make this solution work.  How do I make a page refer to a unique combo of one module and one step.  So either if someone has worked on something like this before and could point me in the right direction? Or if there is another way of doing this more effectively? Or lastly if I need to go back to creating 40 microflows for my wizard to handle “Go_to_next/previous_page”?
asked
1 answers
0

I think you’re on the right track here, but you'll need one helper object that you use as a page parameter for your wizard pages, with also a ModuleType enum attribute to keep track of where you are.

The 40 modules that can be checked are in a separate (persistable) entity with the same enumeration as the helper object. You could also give them a sorting integer attribute. Then you can have one next and one previous button microflow. You retrieve the current module, split on current ModuleType, get the first Module that is chosen and has a higher (next) or lower (previous) sorting number, change the helper object ModuleType to target type and show the corresponding wizard page.

You can also create one snippet for the wizard steps using a layout grid with Auto-fill columns and dynamic classes on the columns. To hide steps you can add a dynamic class that sets display none, based on booleans in your helper object kept in sync for each module that is selected/needed. Then a dynamic class could be something like: if $currentObject/ShowMortgageStep then if $currentObject/CurrentModuleType = MyModule.Enum_ModuleType.MortageValue then 'wizard-step-active' else '' else 'display-none-class'

It can easily get out of hand, especially when you’re adding subflows to validate stuff, but this would be my approach: a helper object, an enum, a snippet for the steps and dynamic classes.

answered