Tuesday, November 14, 2017
Dynamics 365 - Making dialogField as the first field on a dialog - Using Extensions
Recently I got a requirement where I need to add a field to a dialog from a class extending RunBase. I could do it by writing a post event on Dialog method . The post event calls a method on extension class which adds the field.
dfObjectId = _dialog.addField(extendedTypeStr(myEDT));
However this field was always added at the end of the Dialog which the end user do not want as they wanted this dialog field to be the first field on the dialog. I could achieve this by the following piece of code which I added just after the dialogField is added
// Move the Object Number to the top on the Dilaog
control = dfObjectId.control();
parentControl = _dialog.mainFormGroup();
parentControl.moveControl(control.id());
Here is the final code in my extension class method which was called by the post event on dialog method,
public void myDilaog(Dialog _dialog)
{
FormBuildControl control;
FormBuildGroupControl parentControl;
dfObjectId = _dialog.addField(extendedTypeStr(myEDT));
// Move the Object Number to the top on the Dilaog
control = dfObjectId.control();
parentControl = _dialog.mainFormGroup();
parentControl.moveControl(control.id());
}
Thats it!!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment