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

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,827 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

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

#2
André Arnaud de Calavon Profile Picture

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

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 305 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans