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

Data entity method mapDataSourceToEntity() is not executed

(1) ShareShare
ReportReport
Posted on by 612
Hello,
 
I have extended the entity PdsItemBatchAttributeValueV2Entity. I added mapDataSourceToEntity() to it using COC.
I have virtual fields to treat. postLoad() works fine but I want some logic only in case if I want to export, not import.
 
The debugger is not popped when I had a break point in this method or even the event handler onMapingDatasourceToEntity.
 
Does anyone have an idea of why this is happening?
 
Thank you in advance!
Kind regards
I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at
    Can you elaborate your question, please? I don't understand the sentence "I want some logic only in case if I want to export, not import".
     
    If you mean that you want to handle export only, postLoad() is a solution, because it indeed executes only when exporting data from F&O.
     
    If you're actually interested in import to F&O, then you need mapEntityToDataSource() instead of mapDataSourceToEntity().
  • Rati Sharabidze Profile Picture
    612 on at
    Thank you for responding Martin.
    As I know, postLoad() is executed in while exporting and while importing as well.
    I want to give value to virtual fields through x++ only while exporting.
    Therefore, I decided to use mapDataSourceToEntity(). I added it in my extension class.
    The code which was in postLoad() and which was working, did not work there.
    Therefore, I set a break point exactly on the line of "COC's next" and started debugging.
    The debugger was not even popped.
     
    Then I tried the equivalent event handler, copied directly from the entity event list and I had same scenario.
    I think I am missing something but I could not figure out what exactly.
     
    Kind regards
  • Verified answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at
    postLoad() is executed when an entity record is read from database. There you can populate virtual fields before exporting data from F&O. It can't be used for data import, because that would require setting values of underlying table fields, not values of virtual fields.
     
    Can you please explain your exact problem with postLoad()?
     
    As far as I know, mapDataSourceToEntity() indeed isn't called in this scenario and the documentation is right when saying that you should use postLoad().
  • Rati Sharabidze Profile Picture
    612 on at
    Maybe a post from somewhere mislead me. postload() works fine.
    Thank you Martin.

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

#2
André Arnaud de Calavon Profile Picture

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

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans