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

Announcements

No record found.

News and Announcements icon
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 2,003

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
    239,118 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
    2,003 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
    239,118 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
    2,003 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
    239,118 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
    2,003 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
    239,118 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 733

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 461 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 278 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans