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 :
Finance | Project Operations, Human Resources, ...
Answered

insert data to data Entity

(0) ShareShare
ReportReport
Posted on by 390

Hello Team,

I'm new to Dynamics 365 Finance and Operation and hence I need help to know that how to add data to the data entity and the underlying data source, staging table through x++ code?

Also I want know the meaning of getbuffer() and setbuffer()?

I have the same question (0)
  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: insert data to data Entity

    The staging table is only used when you import/export via Data management projects.

    But, you can use the entity for CRUD operations via x in exactly the same way than you would use tables.

    MyDataEntity myEntity;
    
    myEntity.clea();
    myEntity.MyField = 'foo';
    myEntity.insert();

    setBuffer and getBuffer can be used to set/get data source table buffer of data entity data source.

    Here's one example: https://d365dev.com/author/d365dev/

  • Martin Dráb Profile Picture
    236,570 Most Valuable Professional on at
    RE: insert data to data Entity

    What are you trying to achieve? Because your requirement sounds very strange.

    You can easily write code to insert data tables through entities in X++, but then you don't work with staging tables. Staging tables are used when you import data to F&O or export from F&O via data management, not when you work with data entities from code inside F&O.

    Regarding getbuffer() and setbuffer(), can you give us some context?

  • WillWU Profile Picture
    22,361 on at
    RE: insert data to data Entity

    Hi skd,

    You can also have a look at the blog about data entity method:

    rahulmsdax.blogspot.com/.../data-entity-methods-execution-sequence.html

    Getbuffer() is used to get run-time buffer of the Entity datasource, and setbuffer() is used to set the buffer of the Entity datasource.

    As above said, the staging table is used in DMF, you could check the DMFGenerateSSISPackage::generateStagingData() method.

  • skd Profile Picture
    390 on at
    RE: insert data to data Entity

    Hey Martin,

    I just want to add data to my data entity since I wasn't sure how to do it so I mentioned all the tables but now I got it from your reply that how to add data.

    Regarding getbuffer() and serbuffer() I meant was

    Eg: HcmPositionDetail positionDetail = _dataSourceCtx.getBuffer();

    what does this statement exactly mean?

  • skd Profile Picture
    390 on at
    RE: insert data to data Entity

    Hi Will Wu,

    Thank you.

  • WillWU Profile Picture
    22,361 on at
    RE: insert data to data Entity

    Hi skd,

    HcmPositionDetail positionDetail = _dataSourceCtx.getBuffer() is used to get the run time data source buffer(HcmPositionDetail).

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: insert data to data Entity

    getBuffer returns the table buffer of your data source table.

    For example if you have entity MyEntity and it has data source MyTable, then if you call getBuffer method of MyTable data source, you will get table buffer of MyTable.

  • skd Profile Picture
    390 on at
    RE: insert data to data Entity

    Hey Nikolaos,

    Thank you. Can please tell me some standard entity which I can refer to know CRUD operations on entity.

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: insert data to data Entity

    You can use any entities which are not marked as "Read only" in CRUD operations.

    Perhaps I didn't understand what you are asking - in that case could you please explain a bit more what you mean by that question. Thanks!

  • skd Profile Picture
    390 on at
    RE: insert data to data Entity

    what I mean was, could your tell me names of some standard data entities who's x++ code I can refer for CRUD operations on the 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 1,922

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 1,922

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 835 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans