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 :
Finance | Project Operations, Human Resources, ...
Answered

Form datasource eventhandler in AX2012

(0) ShareShare
ReportReport
Posted on by 152

When a record is created from the form level and the item id is given then I want the vendor details to be filled automatically based om the item id.

So do i use onintialized eventhandler or initvalue ? 

What is the difference?

Should is use oncreated or oncreating?

What is onactivated used for?

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    Initialization happens before users can set the item ID, therefore neither initValue nor onIntialized will help. Most likely you want to run the logic when item ID changes, e.g. in modifiedField() method on the table.

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    For your requirement, you should hook in the modification of itemId field, as Martin wrote.

    About your many questions about differences:

    - onInitialized event is fired after super() call of initValue method

    - onCreated is fired after super() call of create method, onCreating is fired before it

    - onActivated is fired after super() call in active method. If you want to run some logic when active (selected) record changes, this is the place

    Functionally there's no difference whether you write your code in active method or use onActivated event handler. Technically the difference is that you either write on top of the standard code (overlayering) or you hook into events that the standard code provides, and place your code in your own classes.

    In D365FO you can't overlayer so you can only use event handlers or Chain of Command (which doesn't exist in AX2012) when you want to enhance the functionality of the standard objects.

  • PrachiGupta97 Profile Picture
    152 on at

    Sir can I use the onmodified eventhandler?

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    Yes you can. By the way, the quickest way to answer "can I?" questions is usually to try it!

  • Verified answer
    KareemTaima Profile Picture
    304 on at

    use modifiedfeild method on the itemId filed, so if any change happens you can recall the data you want in another fields

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 584 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 499 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 254 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans