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)

where to write modified method and Validate write method in D365FO

(0) ShareShare
ReportReport
Posted on by 30

Dear All,

Can you please let me know where to write modified method and Validate write method in D365FO ?

I have a requirement to did modification in Form level.

Please give me more shed on this.

Thanks!

Arpan

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Fedir Kryvyi Profile Picture
    1,026 on at
    RE: where to write modified method and Validate write method in D365FO

    To avoid overlayering you need to create EventHandler for both OnModified and onValidated events instead.

    Just create a new class "FormName_EventHandler", and add you code there.

    You can get snippets of code for event handlers, by expanding Events node of datasource field, right-clicking on desired event and selecting "Copy Event Handler Method"

    4745.123.png

    Code snippet will look like this after you will paste it in your new class:

    [FormDataFieldEventHandler(formDataFieldStr(*FormName*, *Form_DS*, FieldName), FormDataFieldEventType::Modified)]

    public static void Compiler_OnModified(FormDataObject sender, FormDataFieldEventArgs e)

    {

         place your code here

    }

    [FormDataFieldEventHandler(formDataFieldStr(CustPackingSlipJournal, CustPackingSlipJour, Compiler), FormDataFieldEventType::Validated)]

    public static void Compiler_OnValidated(FormDataObject sender, FormDataFieldEventArgs e)

    {      

    }

    Here is an article that you can refer to:

    https://community.dynamics.com/enterprise/b/sertansdynamicsax/archive/2017/05/01/ax7-extensibility-part-3-event-handlers-and-delegates-hooks

  • @rp@n Profile Picture
    30 on at
    RE: where to write modified method and Validate write method in D365FO

    Thanks Fedir and Sukrut

    Sure, I will follow based on your answers

    One things, If I want to use any override methods in form based on requirements then always need to use "Eventhandler class". This is the only way to use override methods in Form ?

    Please give me more shed on this.

    Thanks!

    Arpan

  • Verified answer
    Fedir Kryvyi Profile Picture
    1,026 on at
    RE: where to write modified method and Validate write method in D365FO

    You can also use approach with registerOverrideMethod to totaly override method on the form.

    Check this blogpost for more info: ievgensaxblog.wordpress.com/.../ax-7-how-to-override-form-data-source-field-methods-without-overlaying

    Don't forget to mark your question as "resolved" :D

  • @rp@n Profile Picture
    30 on at
    RE: where to write modified method and Validate write method in D365FO

    Thanks Sukrut,

    Means for customize for we no need to use "EventHandler" class for override methods. We can use override methods same like AX2012

    For Standard form ONLY we should follow  "EventHandler" class.

    is't correct?

    Why in customize form we no need EventHandler class for override methods?

    Please give me more shed on this.

    Thanks!

    Arpan

  • @rp@n Profile Picture
    30 on at
    RE: where to write modified method and Validate write method in D365FO

    Thanks Sukrut

    So, I can use eventHandlerClass and without eventHandlerClass in customized form for override methods. But eventHandlerClass is best way to do.

    right?

    Thanks!

    Arpan

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 3

#3
Willem van Duren Profile Picture

Willem van Duren 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans