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

Custom code execution after entity import execution

(0) ShareShare
ReportReport
Posted on by 5

Hi all,

I need some help.

I would like to call a class after a custom entity is done with the import of all records.
The methods I found so far like mapEntityToDataSource are executed per record during import. 
This is not an option since I want to call my class only once when the last record has been imported and the entity is "done".

What I want to achieve is an entity connected excel that creates purchase orders. 
The excel only contains purchase lines, no header data.
If I for example have 10 purchase lines in the excel and press publish I want the entity to insert the lines in a custom temp table.
When all 10 lines have bin imported I want to trigger a class that generates the PO header and adds the lines to the header.

Next time the user publishes a bunch of lines from the excel a new PO header will be generated and the lines will be added there.


Possible ways i can think of solving this would be
1. find a method that is called in the end of entity execution
2. If there's a message id or similar in the Odata call that i can get hold of.
3. Some how can get the number of lines contained in the entity batch.


All help is appreciated.

BR
Oliver

I have the same question (0)
  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi Oliver, There is a data entity method postTargetProcess which can be used if not required to insert records from ODATA.

    ievgensaxblog.wordpress.com/.../

  • Suggested answer
    GirishS Profile Picture
    27,833 Moderator on at

    Hi Oliver,

    In addition to Mohit comments, refer to the below blog for data entity method call sequence.

    https://axatoz.wordpress.com/2019/03/10/d365-data-entity-sequence/

    Thanks,

    Girish S.

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
André Arnaud de Calavon Profile Picture

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

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 309

#3
Diego Mancassola Profile Picture

Diego Mancassola 259

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans