Skip to main content

Notifications

Announcements

No record found.

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

  • Suggested answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Custom code execution after entity import execution

    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.

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Custom code execution after entity import execution

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

    ievgensaxblog.wordpress.com/.../

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,187 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,966 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans