Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 175888

Update_Recordset and SkipDataMethods still calling update method

$
0
0

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;

}


Viewing all articles
Browse latest Browse all 175888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>