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

Announcements

News and Announcements icon
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,488

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
    240,165 Most Valuable Professional on at

    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,488 on at

    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

    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,488 on at

    Hi Latin,

    Can you share your code.

    Thanks,

    Raziq

  • Ragoza Oleksandr Profile Picture
    737 on at

    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,488 on at

    Hi Ragoza,

    Please share your code with us.

    Thanks,

    Raziq

  • Ragoza Oleksandr Profile Picture
    737 on at

    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,488 on at

    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
    737 on at

    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,488 on at

    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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans