web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Need to update fields on SalesTable but get error : cannot edit a record in Sales orders (Salestable

(0) ShareShare
ReportReport
Posted on by 1,453

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. 

 

*This post is locked for comments

I have the same question (0)
  • Retha Profile Picture
    1,453 on at
    RE: Need to update fields on SalesTable but get error : cannot edit a record in Sales orders (Salestable

    Using a different buffer didn't help. One still updates the same record in the DB.

    I in the end moved my code out of SalesTable and SalesTableListPage and allowed the SaleseditLine form to load for the pick and pack and added my code on the <OK> button there. That way I catches the picking list generation from all different entry points in AX which I was supposed to do. 

    Thanks for all the suggestions. I tried all of them.

  • Retha Profile Picture
    1,453 on at
    RE: Need to update fields on SalesTable but get error : cannot edit a record in Sales orders (Salestable

    I can't add it after super(). Just did it and it loads the SalesEditLines form that is called by the button's menu item . Which means only after the picking list was generated and the form closed will it run my custom which is too late.

    Next is maybe to add it to the init method of the form SalesEditLines? And if it fails, throw an error and hopefully that will leave the form without loading it.

  • Retha Profile Picture
    1,453 on at
    RE: Need to update fields on SalesTable but get error : cannot edit a record in Sales orders (Salestable

    Hi Andre,

    I have added my custom to button buttonUpdatePickingList and the latter has the SaveRecord set to YES.

    However my code runs before super() because I need to stop the call to the menu item run by the click event if the credit check fails.

    I just tried it again. I open the order in Edit mode, then I do not change anything on the header, but go directly to tab pick&pack and click on the Pickinglist button. IT generates the error every time.

    You think I need to add my custom after super()

  • André Arnaud de Calavon Profile Picture
    297,339 Super User 2025 Season 2 on at
    RE: Need to update fields on SalesTable but get error : cannot edit a record in Sales orders (Salestable

    Do you always get this update error? E.g. when you select an existing order; don't change anything and then click your customized button. Do you get the error then? Or only when you also updated other fields?

    Did you also set the SaveRecord property on the new button? Or did you invoke your code on standard methods?

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Mea_ Profile Picture

Mea_ 4

#3
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans