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

Chain of command method rewriting the code for NEXT insert_recordset call

(0) ShareShare
ReportReport
Posted on by 2,699

Hi,

Still getting to the hand of using Chain of command and modifications in D365 FO.

My query is this and probably easily answered.

I have an class method that performs init from another passed in record source.

The main code of this method executes an insert_recordset.

I understand that when I call the NEXT command the original code of the method will execute.

I need to edit the original code the is executed in the NEXT call.

How do I do this? as I need an extra field added to the insert_recordset code.

If I want to update the recordset record that was inserted in the same method I can't because I don't have a recId from the inserted recordset that is executed in the NEXT call.

In the old days, you could fix this in 2 mins by overlayering but in this scenario how do I get my custom field added into the original insert_recordset call in the NEXT command, or how do I override this function?

Thanks

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

    Your suggested solution is impossible to implement. You can't change code of existing methods; you can merely extend it (unless the method explicitly allows being replaced).

    Therefore you need to look for an alternative solution that can be done with extensions or inheritance. For example, you may use update_recordset to update inserted records (using the same query as insert_recordset). It's less efficient than doing it directly, but it allows you to achieve your goal.

    Or maybe you can create a child class, override the method and use your child class instead of the original class.

    If you fail to find any solution that doesn't require changes to existing code, you'll need to ask the owner (Microsoft, most likely) to make it extensible - and then wait.

    By the way, I moved your question from the AX forum.

  • Kauto Profile Picture
    2,699 on at

    Hi Martin

    Thanks for confirming what I thought, I got around the issue by applying an update using similar criteria to the original insert_recordset code from the original method code in the next call via a little workaround.

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 660 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 307 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans