web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

RegisterOverrideMethod was called twice for the same object for method 'validate'. You can only override a method once per instance.

(0) ShareShare
ReportReport
Posted on by 2,476

If I am validating two runtime dialog fields of type FormIntControl using same Validate method , I am getting error as RegisterOverrideMethod was called twice for the same object for method 'validate'. You can only override a method once per instance. Is there any way to bypass this issue as i want to use same validate method for both the fields.

Please help me to get out of this issue

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    236,279 Most Valuable Professional on at
    RE: RegisterOverrideMethod was called twice for the same object for method 'validate'. You can only override a method once per instance.

    Using the same override method for several dialog fields is relatively common (one example is RegisterOverrideMethod.validateGroupOptions()), so it definitely is possible.

    It seems that you're calling registerOverrideMethod() twice for the same dialog field.

  • Mohammad Raziq Ali Profile Picture
    2,476 on at
    RE: RegisterOverrideMethod was called twice for the same object for method 'validate'. You can only override a method once per instance.

    You are absolutely correct martin, I am calling registerOverrideMethod() twice but for two different dialog fields.

    I checked just now that i am binding two different dialog fields with same contract variable, which leads to this error.

    Thanks,

    Raziq

  • Lalit Jivnani Profile Picture
    395 on at
    RE: RegisterOverrideMethod was called twice for the same object for method 'validate'. You can only override a method once per instance.

    Hello Martin and Mohd.

    I am also facing this issue but cannot get solution in this post also.

    Can anyone please tell me the solution for this ?

  • Mohammad Raziq Ali Profile Picture
    2,476 on at
    RE: RegisterOverrideMethod was called twice for the same object for method 'validate'. You can only override a method once per instance.

    Hi Latin,

    Can you share your code.

    Thanks,

    Raziq

  • Ragoza Oleksandr Profile Picture
    735 on at
    RE: RegisterOverrideMethod was called twice for the same object for method 'validate'. You can only override a method once per instance.

    Hello Mohd Raziq Ali, hello Lalit Jivnani,

    I have the same problem, can you please share the code with me as well. Thanks

  • Mohammad Raziq Ali Profile Picture
    2,476 on at
    RE: RegisterOverrideMethod was called twice for the same object for method 'validate'. You can only override a method once per instance.

    Hi Ragoza,

    Please share your code with us.

    Thanks,

    Raziq

  • Ragoza Oleksandr Profile Picture
    735 on at
    RE: RegisterOverrideMethod was called twice for the same object for method 'validate'. You can only override a method once per instance.

    Hi Mohd, please see below:

    class ReportUIBuilder extends SrsReportDataContractUIBuilder

    {

       DialogField                  dialogFieldCategory,

                                    dialogFieldMonthQuarter,

                                    dialogFieldFromDate,

                                    dialogFieldToDate,

                                    dialogFieldReportDate;

       ReportContract insuranceReportContract;

    }

    public void postRun()

    {

       Dialog dialogLocal                    = this.dialog();

       ReportContract contract = this.dataContractObject();

       super();

       dialogFieldCategory     = this.bindInfo().getDialogField(this.dataContractObject(), methodStr(ReportContract, parmCategoryList));

       dialogFieldMonthQuarter = this.bindInfo().getDialogField(this.dataContractObject(), methodStr(ReportContract, parmMonthQuarter));

       dialogFieldReportDate   = this.bindInfo().getDialogField(this.dataContractObject(), methodStr(ReportContract, parmReportDate));

       dialogFieldFromDate     = this.bindInfo().getDialogField(this.dataContractObject(), methodStr(ReportContract, parmFromDate));

       dialogFieldToDate       = this.bindInfo().getDialogField(this.dataContractObject(), methodStr(ReportContract, parmToDate));

       dialogFieldCategory.registerOverrideMethod(methodstr(FormStringControl, lookup), methodstr(ReportUIBuilder, categoryLookup), this);

       dialogFieldFromDate.allowEdit(false);

       dialogFieldToDate.allowEdit(false);

    }

  • Mohammad Raziq Ali Profile Picture
    2,476 on at
    RE: RegisterOverrideMethod was called twice for the same object for method 'validate'. You can only override a method once per instance.

    Hi Ragoza Oleksandr,

     

    Could you please share your whole UI Builder class code. The reason why I am asking this is, you called to registeroverridemethod only once in this piece of code.

     

    Please share it for further trouble shooting.

     

    Thanks,

    Raziq

  • Suggested answer
    Ragoza Oleksandr Profile Picture
    735 on at
    RE: RegisterOverrideMethod was called twice for the same object for method 'validate'. You can only override a method once per instance.

    Hi Raziq, I have found to solution in this post dynamicsaxinsight.wordpress.com/.../ax-2012-multi-select-lookup-for-ssrs-report-dialog

    So I have done only one thing: postRun() method overridden to comment out super() method call.

    super() is commented to avoid the following exception:

    RegisterOverrideMethod was called twice for the same object for method ‘lookup’…

    Let me know if you still need my UIBuilder. Oleksandr

  • Mohammad Raziq Ali Profile Picture
    2,476 on at
    RE: RegisterOverrideMethod was called twice for the same object for method 'validate'. You can only override a method once per instance.

    Hi Oleksandr,

    One suggestion for you is try to  category the code  with respect to method.

    Don't put all code in one method that is not recommended and would not help in debugging.

    Thanks,

    Raziq

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Guy Terry Profile Picture

Guy Terry 2 Moderator

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans