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, ...
Suggested Answer

Data Entity methods usage

(0) ShareShare
ReportReport
Posted on by 1,965

PostLoad

MapdatasourceToEntity

MapEntityToDataSource

PostTargetProcess

For each method above

1. Which one is used for import and which one is used for export. also could one of them be used in both import and export?

2. Can someone give me a simple/clear real example on when to use each one? I want a real scenario so that I can differenceate when to use each one and to know why this method only will work in this scenario and why other methods won't work.

I have the same question (0)
  • Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    "Data source" means tables. Map entity to data source means mapping entity to the actual table, i.e. import. The other way is export.

    "Staging to target" is also about moving data from entities to F&O tables (import).

  • .. Profile Picture
    1,965 on at

    Hi Martin

    1. So "MapEntityToDataSource" and "postTargetProcess" are used for Import. But what's the difference between both? And when should I use each one? Is there a real example?

    2. MapDataSourceToEntity is for export...but when should I use this method..in what cases?

    3. postLoad..is it for export or impot? And when should I use it?

  • Suggested answer
    Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    map* methods are used for mapping data fields between an entity record and particular table records. E.g. when you want to say that field A of the entity should be transformed and written to field B of table T1.

    postTargetProcess() executes after everything was written to tables.

    postLoad() is called when a record is loaded from database. In case of entities, you read data when you want to export it.

    The standard application is full of real examples. You can also use a search engine to find more information about these methods, such as blog posts. An example about postTargetProcess(): AX 7. Process the data after Data Entity import.

  • .. Profile Picture
    1,965 on at

    Hey Martin,

    1. Is Table T1 inside the entity?

    So let's say the entity has two tables

    T1 and T2

    You want the value of field A in T2 to be updated with field B in T2?

    But now what's the difference between updateEntityDataSource and MapEntityToDataSource?

    2. If postload is used for export, then when to use MapDataSource to entity and when to use postLoad.. what's the difference?

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

    1. updateEntityDataSource() is called when a table is being updated, but not when a new record is inserted. mapEntityToDataSource() is called before both of them and therefore the mapping applies to both inserts and updates.

    2. Use mapDataSourceToEntity() in all cases except of populating a virtual field. If you're interested in virtual fields, you'll find more details (including sample code) in F&O documentation.

  • .. Profile Picture
    1,965 on at

    Hey Martin,

    So it's either I put the logic twice in updateEntityDataSource and InsertEntityDataSource OR I put the logic in MapEntityToDatasource?

    So they are used for the same thing?

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

    Duplicating the same logic in both methods would be a design flaw.

    mapEntityToDatasource() is the right method for this purpose.

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 611 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans