Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Update_Recordset and SkipDataMethods still calling update method

(0) ShareShare
ReportReport
Posted on by

I'm working in AX 2012 R3.  I have a table with an overridden update method that does an update_recordset on the same table for records that do not have the same RecId.  When the user makes a change to a column in one row, all other rows get updated with the modified value.  We have skipDataMethods being called on the table buffer prior to the update_recordset.  The intention is that calling skipDataMethods will avoid an infinite loop of updating or update conflicts on the table.  However, recently we found that our update_recordset is degrading to row by row updates and creating some update conflicts because each row being updated was somehow calling the update method which triggered the same update over and over, despite having skipDataMethods called prior to the update_recordset.  I was confused as to why the update method was being called so I just started trying stuff.  I added a call to skipEvents and suddenly this works as desired, the update method is no longer called for each updated row.  There are no event handlers on any of the methods on my table so I'm not sure why skipEvents is necessary.  Does anyone know why I might need to call skipEvents to stop the data methods from firing when I already have skipDataMethods called?  I believe this has been working fine in the past several years.  I'm not sure if a somewhat recent update to R3 has caused the issue we're seeing.  I'm not a huge fan of this requirement/design but I've inherited the maintenance of this code and I'm trying to help our users get past this error.  Adding skipEvents seems to work but I'm unclear why it was needed.  Any insight would be greatly appreciated.  

Also, I attempted to reproduce this issue creating a new table with a couple fields and applying this pattern.  Testing this out with a simple job to update a row and seeing it update the other rows in the table is working fine with only the SkipDataMethods and I didn't need the skipEvents.  So I'm at a loss as this is inconsistent with what I see on the issue that my user reported. 

The code looks like this: 

public void update()

{

MyTable myTable;

super();

// adding this line seems to fix the issue- i'm not sure why

myTable.skipEvents(true);   

// i am unsure why i need skipEvents when skipDataMethods should suffice

myTable.skipDataMethods(true);    

// despite skipDataMethods, this calls the update method for each row being updated unless I added skipEvents

update_recordset myTable

setting myField = this.myField

where myTable.RecId != this.RecId;

}

  • Suggested answer
    Pradeep Kumar Pachamuthu Profile Picture
    75 on at
    RE: Update_Recordset and SkipDataMethods still calling update method
    [quote user="Brawndo"]

    I'm working in AX 2012 R3.  I have a table with an overridden update method that does an update_recordset on the same table for records that do not have the same RecId.  When the user makes a change to a column in one row, all other rows get updated with the modified value.  We have skipDataMethods being called on the table buffer prior to the update_recordset.  The intention is that calling skipDataMethods will avoid an infinite loop of updating or update conflicts on the table.  However, recently we found that our update_recordset is degrading to row by row updates and creating some update conflicts because each row being updated was somehow calling the update method which triggered the same update over and over, despite having skipDataMethods called prior to the update_recordset.  I was confused as to why the update method was being called so I just started trying stuff.  I added a call to skipEvents and suddenly this works as desired, the update method is no longer called for each updated row.  There are no event handlers on any of the methods on my table so I'm not sure why skipEvents is necessary.  Does anyone know why I might need to call skipEvents to stop the data methods from firing when I already have skipDataMethods called?  I believe this has been working fine in the past several years.  I'm not sure if a somewhat recent update to R3 has caused the issue we're seeing.  I'm not a huge fan of this requirement/design but I've inherited the maintenance of this code and I'm trying to help our users get past this error.  Adding skipEvents seems to work but I'm unclear why it was needed.  Any insight would be greatly appreciated.  

    Also, I attempted to reproduce this issue creating a new table with a couple fields and applying this pattern.  Testing this out with a simple job to update a row and seeing it update the other rows in the table is working fine with only the SkipDataMethods and I didn't need the skipEvents.  So I'm at a loss as this is inconsistent with what I see on the issue that my user reported. 

    The code looks like this: 

    public void update()

    {

    MyTable myTable;

    super();

    // adding this line seems to fix the issue- i'm not sure why

    myTable.skipEvents(true);   

    // i am unsure why i need skipEvents when skipDataMethods should suffice

    myTable.skipDataMethods(true);    

    // despite skipDataMethods, this calls the update method for each row being updated unless I added skipEvents

    update_recordset myTable

    setting myField = this.myField

    where myTable.RecId != this.RecId;

    }

    [/quote]

    I know this is an old post but still it could be beneficial for someone.

    SkipDataMethods only wont work, as there can be eventHandlers  associated to the methods.

    So it always safer to call as below, but again it depends on your requirement as well.

    private static void skipLogAndDataMethods(
    Common _record)
    {
    _record.skipDatabaseLog(true);
    _record.skipDataMethods(true);
    _record.skipEvents(true);
    }

  • Greg's Mom Profile Picture
    on at
    RE: Update_Recordset and SkipDataMethods still calling update method

    Thank you, Nikolaos.  I agree with your statements.  I did simplify the requirement a bit in my description.  It's not exactly the same value in every row.  The requirement is that if a user changes the description on one line then other lines with the same activity number and project should be updated to match.  As you stated, a refactor of this design would be good.  

    However, I'm more curious why calling skipUpdateMethods would not work in this instance and why I had to call skipEvents to stop the update_recordset from falling back to row by row.  My understanding is skipUpdateMethods should be enough here since there are no events on my table methods.  

  • nmaenpaa Profile Picture
    101,158 Moderator on at
    RE: Update_Recordset and SkipDataMethods still calling update method

    Update_recordSet will fall back to row by row, if update method is overridden.

    Your customization sounds strange. Why store this same info in all records? If it's always the same for all records, store it in a separate table. This way you need exactly one record.

    Your current solution is asking for trouble such as deadlocks, or inconsistent data (your code is skipped if anyone calls doUpdate).

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 601 Most Valuable Professional

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 416

#3
Adis Profile Picture

Adis 384 Super User 2025 Season 1

Product updates

Dynamics 365 release plans