Thursday, July 31, 2014

Mandatory Fields on Dialog Form

Problem: Need to make dialog fields mandatory such that users cannot proceed without entering require info.
Environment : AX 2012R3.
Module : Service Management
Difficulty : Easy

This occurs when i try to move the service order around different stages. The standard dialog appears as shown below. 
To make these fields mandatory open the class: Classes>>SMAStageEngine. In the dialog method, add the following lines as shown. NB your intellisense my not show the mandatory method, you can however type it as shown.

This will achieve your aim BUT you will notice that despite your fields showing the require fields underlined in red, the behavior of the dialog will be somewhat strange as you will be able to proceed without entering any data.
To get around this, override the validate method of the runbase class, and add the following depending on the fields you want to apply in your scenario.

Once this is done you can be guaranteed that records will be validated to make sure data is entered in your dialog fields.

Happy Daxing!

No comments:

Post a Comment