Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Register Override Method in Dialog Form

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi Everybody,

I need to achieve that when checkbox1 is enabled , the checkbox2 have to be disabled , so i used registerOverrideMethod in a dialog Form , here my question is how can i achieve this when the DialogField is not globally declared but it was inside Dialog() method?

*This post is locked for comments

  • Verified answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Register Override Method in Dialog Form

    Why do you think that this control have names that you using ? Use personalization or debugger to find real nanes, they would be like fld_1_1, something like that

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Register Override Method in Dialog Form

    Hi ievgen,

    class Simpledialog extends RunBase

    {

       Dialog ret;

    }

    protected Object dialog()

    {

       Dialogfield dialogField1;

       DialogField dialogfield2;

       ret = super();

       dialogField1 = ret.addField(enumStr(NoYes),"DialogField 1","");

       dialogField2 = ret.addField(enumStr(NoYes),"DialogField 2","");

       dialogField1.registerOverrideMethod(methodStr(FormComboBoxControl,modified),methodStr(Simpledialog,updateDlgFld1),this);

       dialogField2.registerOverrideMethod(methodStr(FormComboBoxControl,modified),methodStr(Simpledialog,updateDlgFld2),this);

       return ret;

    }

    public boolean updateDlgFld1(FormComboBoxControl _f)

    {

       if(ret.formRun().design().controlName("dialogField1").valueStr() == "1")

       {

           ret.formRun().design().controlName("dialogField2").enabled(false);

       }

       else

       {

           ret.formRun().design().controlName("dialogField2").enabled(true);

       }

       return true;

    }

    public boolean updateDlgFld2(FormComboBoxControl _f)

    {

       if(ret.formRun().design().controlName("dialogField2").valueStr() == "1")

       {

           ret.formRun().design().controlName("dialogField1").enabled(false);

       }

       else

       {

           ret.formRun().design().controlName("dialogField1").enabled(true);

       }

       return true;

    }

    public static void main(Args _args)

    {

       Simpledialog ob = new Simpledialog();

        ob.prompt();

    }

    Could someone help me out? Am getting error as "Object Not Initialzed" when the checkbox is enabled

  • Ernest  Dmytrenko Profile Picture
    Ernest Dmytrenko 140 on at
    RE: Register Override Method in Dialog Form

    If you declare DialogField inside the dialog() method, you won't be able to get the value from that fields in the getFromDialog() method. You have to declare it in classDeclaration.

    Then you'll be able apply registerOverrideMethod() for you dialogfield control.

    I'm not quire sure if you would need to achieve it by controlName() method because on RunBase dialog form dialog field names generated automatically. So you'd need to assign a name to desired field.

  • Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Register Override Method in Dialog Form

    Could you please share code that throws the error?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Register Override Method in Dialog Form

    Hi ievgen,

    I'm getting error as Object Not Initialized inside the Overrided Method when i'm getting whether MyControl is enabled

  • Verified answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Register Override Method in Dialog Form

    Hi Vairam Srinivasan Sankaramoorthy,

    You don't need dialogField, you need control. And you can get control from adialog, like dialog.formRun().design().controlName("MyControl");

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans