Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Suggested answer

Update data using DMF Data entity in X++

(0) ShareShare
ReportReport
Posted on by 10

Hi, How can we update data using data entity through x++codes. Can we achieve it?

I am using similar code as mentioned  in below sample:

 

CustCustomersV3Entity entity;

entity.selectforupdate(true);

entity.CustomerAccount = xyz;

entity.CustGroup = custgroup1;

ttsbegin;

entity.update();

ttscommit;

  • junior AX Profile Picture
    1,550 on at
    RE: Update data using DMF Data entity in X++

    Hi Girish and Mohit,

    I saw this question and i got attracted by your replies.

    Do you both mean that, when we update the entity all nodes in the entity will be updated even if the change was specified in code was for one table only? I mean if the entity let's say have 5 tables joined together, a select for update will be called 5 times?

    And Mohit, when u said if data validation is skipped in data entity level but essential in table level. First how can this be skipped? And can you please give a real example to explain the issue..i mean what important validations we shouldn't skip in data entity level?

  • Mohit Rampal Profile Picture
    12,556 Moderator on at
    RE: Update data using DMF Data entity in X++

    Hey Girish, I'm not saying "Data entity cannot be used in the code for CRUD operation via code". It is possible to use it in CRUD operation but 'should' not be used unless there is very strong reason to do it. One reason you mentioned, It will consume more time to update the record. How about if table validation is skipped in Data entity level and essential in table level.

  • GirishS Profile Picture
    27,823 Moderator on at
    RE: Update data using DMF Data entity in X++

    I think you cannot say "Data entity cannot be used in the code for CRUD operation via code.

    It can be used for CRUD operation when you are updating or inserting record from multiple tables.

    But in respective to the thread, you can say it's better to update the Cust Table as he only needs to update record only in Cust Table.

    Thanks,

    Girish S.

  • Mohit Rampal Profile Picture
    12,556 Moderator on at
    RE: Update data using DMF Data entity in X++

    Please use CustTable directly in your code. Data entity is to export/import tables data in a normalized view, should not be updated directly via code.

  • Suggested answer
    GirishS Profile Picture
    27,823 Moderator on at
    RE: Update data using DMF Data entity in X++

    It will be better to update customer data using CustTable instead of Data Entity. It will consume more time to update the record in the database as Entity will have more tables added as DataSource.

    Thanks,

    Girish S.

  • Pranav Sinha Profile Picture
    10 on at
    RE: Update data using DMF Data entity in X++

    I want to update it through code if customer already exists. So I am checking for possibility of it can be done using data entity or i will need to use table to update customer.

  • Suggested answer
    Mohit Rampal Profile Picture
    12,556 Moderator on at
    RE: Update data using DMF Data entity in X++

    Hi Pranav, You can try it but it is not a right approach. Do you want to update data entity only and not CustTable table? If not, then you can use excel-in to edit and publish the data which will update both CustCustomersV3Entity and CustTable or use Data project in Data management to import data entity.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,884 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,748 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans