web
You’re offline. This is a read only version of the page.
close
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

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

I have the same question (0)
  • Verified answer
    Mea_ Profile Picture
    60,284 on at

    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");

  • Community Member Profile Picture
    on at

    Hi ievgen,

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

  • Mea_ Profile Picture
    60,284 on at

    Could you please share code that throws the error?

  • Ernest  Dmytrenko Profile Picture
    140 on at

    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.

  • Community Member Profile Picture
    on at

    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

  • Verified answer
    Mea_ Profile Picture
    60,284 on at

    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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans