When the user presses the finish button, some actions should be triggered in order to complete the wizard. The developer can add code to decide what will happen when the wizard is finished, and perform global validations on the data entered by the user.
Depending on the implementation of the wizard, this code can be added in different places. In this case, we will add it inside the Wizard Main Panel events.
Before the wizard is completed, the subroutine U_BeforeComplete is fired. This subroutine can be used to invalidate the wizard by setting the variable &IsValid_WizardMain to false if certain conditions are not met and also it can be used to add code to persist the result of the wizard in some data structure.
- Go to "InvoicePaymentWizard" events and add the following code to 'U_BeforeComplete(WizardMain)' subroutine. Note: We are going to use procedure "NewPayment" that was already created in the KB.
|Before Complete Subroutine
This subroutine is fired when the wizard is completed. In this method the developer can choose, for example, to navigate to another panel, or to return to the caller.
In this case, we want to navigate to the payment entity manager once the payment is done.
- Open "Payment" transaction and apply Entity Services pattern.
- Apply Trn Form pattern.
- Go to 'U_AfterComplete(WizardMain)' subroutine inside 'InvoicePaymentWizard' web panel and add the following code(Note: If this object doesn't exist, apply Entity Services pattern to Payment transaction):
|After Complete Subroutine