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 :
Dynamics 365 general forum

Override "Modified" method in dialog

(0) ShareShare
ReportReport
Posted on by

Hey guys,

I was wondering if anyone faced the same issue in D365.

I actually have a dialog (Runbase) where i want to override the "modified" method for a dialog field, So i used the "Register Override Method" just like i did to override a lookup (that is working just fine).

Here is my code that i'm naturally placing in the "Dialog" Method of the class : 

DialogField.registerOverrideMethod(methodStr(FormStringControl, modified),methodStr(MyClass, MyMethod), this);

The issue here is that my method "MyMethod" is working and the code inside is executed correctly, but when i change the value of the field and i leave the field, i get this : 

3173.SCSHOT.jpg

Categories:
I have the same question (0)
  • Sukrut Parab Profile Picture
    71,710 Moderator on at

    Make sure you call you modified method in PostRun method after super()

  • Community Member Profile Picture
    on at

    Thanks for the reply,

    There is no "PostRun" method, only "DialogPostRun" and i tried that, still not working.

  • Suggested answer
    Sukrut Parab Profile Picture
    71,710 Moderator on at

    Are you using SysOperationframework ?  Use UI builder class there you will see postRun ,PostBuild method.

    Look at class PurchReqStatisticsUIBuilder  to see example.

    community.dynamics.com/.../using-ui-builder-class-to-develop-ssrs-reports-in-microsoft-dynamics-ax-2012

  • Suggested answer
    Basheer17 Profile Picture
    2,720 on at

    Hi GoProX,

    In your code registerOverrideMethod method's last parameter should be your MyClass object.

  • Suggested answer
    Mea_ Profile Picture
    60,284 on at

    Hi GoProX,

    MyClass.MyMethod accepts FormStringControl  as a parameter, lets say FormStringControl _control.

    You need to call _control.modified();

    in MyClass.MyMethod to trigger actual modification, so it will act as a super().

  • Community Member Profile Picture
    on at

    Hi Mohammad,

    In my case i'm passing 'this' it's the same here.

  • Community Member Profile Picture
    on at

    Hi Ievgen,

    Yes i'm already calling it in my method as you said. did it ever work for you in AX 7 ?

  • Mea_ Profile Picture
    60,284 on at

    It's hard to say what is wrong without seeing actual code. Warning that AX shows you is caused by validate method not returning true, so you need to figure out if validated is called and if it returns true.

  • Community Member Profile Picture
    on at

    Yeah i've tried to override the validate method too to make it return true just to be sure if it's the validate that is responsible of this. still facing the same problem.

    And like i said, it works with no problem for other methods, it's just the "modified" that gets stuck

  • Verified answer
    Community Member Profile Picture
    on at

    Hi GoProX,

    It's quite a time from your question but still can help others.

    The probably answer is you have to return true in your override method.

    it should looks like:

    class MyClass
    {
        private boolean myMethod(FormStringControl _control)
        {
            boolean ret = _control.modify(); //instead of super() if you need it.
            //place your code here.
            return ret;
        }
    }


     

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Dynamics 365 general

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans