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 :
Microsoft Dynamics AX (Archived)

Using pre/post event handlers on modifiedField() method of a table in case of customization

(0) ShareShare
ReportReport
Posted on by 705

Hi,

I have some customize code in modifiedField(FieldId _fieldId) method of an existing table. I am trying to move all the customization from the method. Is it feasible using pre/post event handlers for modifiedField() method?

And if so, how can I get the fieldId in my event handler method, which we take as an argument in modifiedField()? 

*This post is locked for comments

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

    No, a better approach it using modeled events. Expand Events node of the table and subscribe to onModifyingField or onModifiedField event.

  • Verified answer
    Nishant2408 Profile Picture
    705 on at

    Okay Martin.

    Now how can I get the value of fieldId in onModifiedField event?

  • Verified answer
    Mea_ Profile Picture
    60,284 on at

    Hey Nishant Srivastava ,

    When you will create event handler it will accept 2 parameter  

    (Common _sender, DataEventArgs _e)

    Where _sender is a record and _e could be cast to ModifyFieldEventArgs, like

    ModifyFieldEventArgs args = _e as ModifyFieldEventArgs;

    Than you can get filedId by using next code:

    args.parmFieldId()


  • Verified answer
    Martin Dráb Profile Picture
    237,882 Most Valuable Professional on at

    You get such information in event arguments, you just have to cast the general type to the specific one.

    ModifyFieldEventArgs eventArgs = e;
    eventArgs.parmFieldId();
  • Community Member Profile Picture
    on at

    Thanks for posting this solutions, Martin. This was exactly what I needed to have modifiedField functionality on fields I added to a SalesLine extension.

  • nmaenpaa Profile Picture
    101,160 Moderator on at

    Since the previous answers are from year 2016, they are partially outdated. Nowadays it's possible (and easier) to use Chain of Command instead of event handlers. But of course event handlers do still work, and there are scenarios where you need to use them.

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Sukrut Parab Profile Picture

Sukrut Parab 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans