Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

create multiple Entitys in a single request from a plugin

(0) ShareShare
ReportReport
Posted on by

I have a general question around efficiency and best practice. 

I have read on the Microsoft forum that I should avoid using ExecuteMultipleRequest in my plugins at all costs however it seems to me that its far less efficient to make say 10 calls when 1 call would do, so far my plugin has been working fine without issue however now I'm attempting another creation I'm hitting issues.

For example i have a plugin that updates the opportunity record with opportunityproduct(s), in this example I'm updating with 10 products,

i use ExecuteMultipleRequest to create the product entities in one transaction,
i use ExecuteMultipleRequest to set the state / status of the product entities (SetStateRequest) in one transaction,
i use ExecuteMultipleRequest to create productpricelevel entities 

- so far this process has taken between 3,000 - 3,531 ms 

I then use ExecuteMultipleRequest to create the Opportunityproduct entities in one transaction (there are only 10 records to create)

- plugin execution time drastically jumps to 120,036 causing time out error.


  • Suggested answer
    a33ik Profile Picture
    84,329 Most Valuable Professional on at
    RE: create multiple Entitys in a single request from a plugin

    Let me re-read that for you.

    1. You read that ExecuteMultiple shouldn't be used from within a plugin.

    2. You develop a plugin and use ExecuteMultiple, your plugin hit the timeout error.

    3. You create a post here describing your issue.

    Doesn't it look for you contradictory?

  • RyanCRM Profile Picture
    on at
    RE: create multiple Entitys in a single request from a plugin

    This is where i read that ExecuteMultiple should not be used from within a plugin - docs.microsoft.com/.../avoid-batch-requests-plugin

  • Suggested answer
    a33ik Profile Picture
    84,329 Most Valuable Professional on at
    RE: create multiple Entitys in a single request from a plugin

    Hello,

    Can you please provide a source where you read about the usage of ExecuteMultiple from plugins?

    It makes no sense because:

    1. Plugin is executed in transaction itself.

    2. Plugin's code is executed near-door to the Api of Dynamics, so there are no losses with travel time.

    My recommendation - don't use ExecuteMultiple from plugins. It makes sense to use it from other apps but not from plugins.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,274 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,947 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans