My company's credit checking works a bit different than what the standard AX provides. We also decided to make use of the order hold codes in the credit checking process.
One of the changes I need to do is when the end-user (Forms Salestable as well as SalesTableListPage) clicks on Pick&Pack -> PickingList button, to run on the click-method our custom credit checking process. If the order needs to go on hold, I need to create the mcrHoldCodeTrans record as well as updating the custom 3 creditcheck fields that was added to Salestable.
My code can create the mcrHoldCodeTrans record without a problem because it is not a form datasource.
However SalesTable is a form datasource and I need to update those 3 fields because afterwards some of the functionality needs to be disabled until the order was cleared by the credit manager. If the order passed the credit checking I still have to update the fields on SalesTable to indicate the pass status with date passed etc.
I have placed my custom in a custom class to limit changes in the standard code. The actual update of the 3 fields are in a custom method on table SalesTable which is called from the class. However when it comes back from the class I get the error:
"Cannot edit a record in Sales orders (SalesTable).
The values displayed in the form are not current, so an update or deletion cannot be made. To view the current values, on the Command menu, click Restore or press CTRL+F5."
I have to run salesTable.update() (inside a ttsBegin and ttsCommit of cause) else nothing is updated. I have added in the click-method a salesTable_ds.research(true); after the call to the class method but that still doesn't stop the error.