Skip to main content

Notifications

Small and medium business | Business Central, N...
Answered

Execution order of subscriptions for the same event (BaseApp vs PTE)

Posted on by 10

Hi All,

There is one question I seek for your advise :

"If Microsoft baseapp is subscribing to an event, and our app as PTE are also subscribing to that event, will Microsoft BaseApp codes always run first ?"

Real scenario is :
On codeunit 5345 "Integration Rec. Synch. Invoke".There are events OnAfterInsertRecord and OnAfterModifyRecord.
Microsoft baseapp is subscribing to those events in codeunit 5341 "CRM Int. Table. Subscriber".
One of the thing that BaseApp's codes do is when synching 'CRM Salesorder-Sales Header', it will change the status of Sales Order to Release.

The thing is, we need the status to be Open after synchronize
(We will need to do approval in Business Central ).

p.s :
I tested subscribing to that event and set the status to open and it works fine in Sandbox ( Baseapp's codes will run first). Probably due to my app ID is smaller that BaseApp ID.
Baseapp ID  : 437dbf0e-84ff-417a -***
Our app ID   : ea74d4be-8b1f-46ce-***

The thing is that I am not 100% sure that this will always work without failing if I apply to prod.

So, it would be appreciated if you have any reference or experience that can be shared.

  • HHalim Profile Picture
    HHalim 10 on at
    RE: Execution order of subscriptions for the same event (BaseApp vs PTE)

    Hi Yun zhu,

    Thanks.

    I also agree, I think between BaseApp and Our PTE, regarding the order of execution,  the App ID's rules should still apply.

    I will do more testing, and let you guys know if any update.

    Thanks

  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 73,339 Super User 2024 Season 2 on at
    RE: Execution order of subscriptions for the same event (BaseApp vs PTE)

    Hi, I think the BaseApp just defines the Event, and where it is executed. If the standard Event's are called in BaseApp, I think the rules I tested for App ID's are still valid.

    PS: If you are referring to the order of execution in different triggers, you can check Kauffmann's blog.

    https://www.kauffmann.nl/2018/03/24/table-trigger-events-in-dynamics-365-business-central/

    pastedimage1675044891482v1.png

    Hope this helps as well.

    Thanks.

    ZHU

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: Execution order of subscriptions for the same event (BaseApp vs PTE)

    There is simply no guarantee in what order a event subscriber code will be exceeded.

    So if you need something to happen in the system after every other subscribers code is executed then you need another strategy instead of using an event subscriber.

    Maybe it will be better to use a job that is triggered by a job queue or something that is triggered by power automate. It all depends on your business needs.

  • HHalim Profile Picture
    HHalim 10 on at
    RE: Execution order of subscriptions for the same event (BaseApp vs PTE)

    Hi Mohana,

    Thanks for replying.

    I went through Yzhum blog regarding the extension order before. It was a great help.

    Anyway, the testing is between PTE's.

    I just hope may be there is a more certain documentation somewhere if between Microsoft BaseApp and partner's PTE.

    Thanks

  • Verified answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,133 Super User 2024 Season 2 on at
    RE: Execution order of subscriptions for the same event (BaseApp vs PTE)

    AFAIK, there is no guarantee in the order of execution of subscribers.

    But you can refer this

    https://yzhums.com/22715/

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,228 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans