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 :
Customer experience | Sales, Customer Insights,...
Unanswered

Asynchronously triggering a Custom API action from a plugin

(0) ShareShare
ReportReport
Posted on by 5

Hi all,

I'm attempting to update a plugin that's currently timeing out when running a Custom Api action repeatedly for different entities. Right now the only way I can do this is using an external program to trigger the actions asynchronously, but I'd like to get this running from within a plugin.

I've already tried using the ExecuteAsyncRequest class, but this doesn't seem to work with custom API requests, and the ExecuteMultipleRequest class, which forces you to wait until all requests are finished.

I don't need to read the responses once the jobs are started as the results are logged elsewhere, and the order the requests are executed in don't matter.

I have the same question (0)
  • RodRodriguez Profile Picture
    on at

    Howdy!

    Instead of batching them and using execute multiple, have you looked at simply executing them individually?

    Per the documentation:

    docs.microsoft.com/.../execute-multiple-requests

    "Custom code in the form of plug-ins and custom workflow activities may execute ExecuteMultipleRequest. However, this is not recommended"

    Following the guidance here:

    docs.microsoft.com/.../avoid-batch-requests-plugin

    In the "Additional Information" sections it states:

    ExecuteMultiple and ExecuteTransaction messages are considered batch request messages. Their purpose is to minimize round trips between client and server over high-latency connections. Plug-ins either execute directly within the application process or in close proximity when sandbox-isolated, meaning latency is rarely an issue. Plug-in code should be very focused operations that execute quickly and minimize blocking to avoid exceeding timeout thresholds and ensure a responsive system for synchronous scenarios. Simply submit each request directly instead of batching them and submitting as a single request.

    For example: foreach (request in requests) service.Execute(request)

  • ATBennett Profile Picture
    5 on at

    Using a foreach loop is how the plugin was originally written, but there's simply too much work to do synchronously in 2 minutes. For the time being I've switched it to use the ExecuteMultipleRequest class as (based on my testing) this continues to execute even if the original plugin timed out minutes ago. I think the best long term solution to this is going to be moving the logic out into an azure function that's triggered by the plugin.

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 137 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 128

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 55 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans