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

Strange error message when tried to update a record from a form

(0) ShareShare
ReportReport
Posted on by 30

Hello. This is my first post on this forum, I'm not even sure whether this is the right forum for the question. If it's not, please redirect me to the right forum.

So I have a form which is used for displaying and maintaining data from a Setup table. The table has a field named SetupMainAccount, which is related to the system table MainAccount through its field RecId. The field shows Account Number from the MainAccount table, but the client also wants to see the Account Number value in a separate column. So I've done it by adding MainAccount table to the form's data sources, along with my main Setup table, and specified the relation between the two data sources. The MainAccount data source's properties Allow Create, Delete and Edit are all set to No, because I don't want any data from this table to be updated through this form. I have then added the MainAccount.Name field to the data grid, and everything looks fine initially. The problems begin when I change the Account number value from the dropdown in the grid, and try to save the record, the following message pops up:

6874.pastedimage1663166317554v1.png

Does anybody know what causes this message. I have not called this function, but I have found that this function is called from the MainAccount table class's update method. It probably means that update of MainAccount  table's record is attempted, but how can I prevent it?

I have the same question (0)
  • Ascalab Profile Picture
    30 on at

    My last sentence is not readable on the scree, as per what I can see. I wrote - It probably means that the update of MainAccount table is attempted, but how I can prevent it?

  • Verified answer
    Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    Setting AllowEdit = No isn't sufficient. You need to override write() and validateWrite() methods of the data source. Write() shouldn't contain any code and validateWrite() should simply return true, without calling super().

  • Ascalab Profile Picture
    30 on at

    Thanks goshoom , this fixed the issue. Can I ask about one more detail related to the same task, or it should maybe go to another question? When I update the Account Number field (through the dropdown list), the related field Account Name is not updated until the record is saved in the database. Is it possible to update the Account Name value before saving the record?

  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    It would be indeed better in a new thread, because it's not about "Strange error message when tried to update a record from a form".

    The related record indeed isn't loaded from database when you merely change a value of the other field (and you don't save the change to DB). But if you want to show it to users immediately, you can override modified() method of the data source field and implement the logic there.

  • Ascalab Profile Picture
    30 on at

    You're goshoom , I've created the new thread. Please respond there if you can.

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