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

CoC on Modifiedfields not working

(0) ShareShare
ReportReport
Posted on by 903

Hi guys,

I created an CoC on ModifiedFields for table ProjCostTransSale in hope that I can insert some procedure when the TransStatus is changed. However it didn't work and while debugging, I found out my break point not even hit my CoC

I even tried to put break point in ProjCostTransSale table, Update method it self, but the breakpoint "ignored".

Anyone can suggest what happened and what should I do to intercept when some field in this table is modified ?

Thanks,

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

    What do you do when you expect modifiedField() to be called?

    Note that modifiedField() and update() are called at completely different times. modifiedField() gets called immediately after changing a field value in a form, while update() is called later, when a record is being saved to database.

  • Tony zhong Profile Picture
    903 on at

    Hi Martin,

    In modifiedField() I would like to run some update_recordset to another table if the the field modified to certain condition. When you said chaging a field value in a form, does it meant it will be called "only" when it is change from a form ? if it was changed by backend process, it will not hit this ?

    Thanks,

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

    Updating other tables from modifiedField() is usually a bug. Think it through again, please. The problem is that the record with the modified field doesn't have to be actually saved to database (because the user closes the form without saving, a validation fails, a connection gets interrupted and so on). But you already changed another table based on this change that never happened. The correct approach is updating other tables when this table is being saved to database (in the same database transaction, therefore both changes either happen together or don't happen at all).

    modifiedField() is indeed called automatically only from forms. It can be explictly called from X++, but it's not called automatically when you update a table from code. That's another reason why your design is wrong and you should run the logic in update() (and possibly insert() and delete()).

  • Anton Venter Profile Picture
    20,346 Super User 2025 Season 2 on at

    Correct, the modifiedField method is not called in code. So that's why your extension was not called. The update method of the table is also not guaranteed to be called by the system. Check the code with the debugger.

  • Tony zhong Profile Picture
    903 on at

    Hi Martin,

    Understood and noted. I moved the update_recorset() in Updates() method. It works fine now.

    Thanks for your guidance.

    Thanks,

  • Tony zhong Profile Picture
    903 on at

    But just one more thing,

    As mentioned before, I actually put the breakpoint in the original table "ProjCostTransSale" Update method as well, while the CoC's breakpoint on the same Update method hits (and stop), I wonder why the breakpoint in Update method of original table it self not working ?

    Thanks in advance,

  • Martin Dráb Profile Picture
    237,990 Most Valuable Professional on at

    For example, you may have Visual Studio configured to load debugging symbols only for objects in your solution.

  • Tony zhong Profile Picture
    903 on at

    ic.. maybe so

    Ok thanks.

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
Abhilash Warrier Profile Picture

Abhilash Warrier 669 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

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

#3
Martin Dráb Profile Picture

Martin Dráb 384 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans