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 :
Microsoft Dynamics CRM (Archived)

Making synchronous API calls

(0) ShareShare
ReportReport
Posted on by 676

Hi,

By default the API calls made in CRM dynamics are asynchronous in nature. But I am in a situation where I wish to make synchronous API calls. 

Any suggestion on the same would be highly appreciated.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Clem Profile Picture
    2,541 on at

    Don't forget to check the CRM Rest Builder in order to get the correct query you want :

    2017_2D00_03_2D00_24_5F00_17_2D00_27_2D00_35_2D00_chrome.png

    You can create basic queries to the webapi using XMLHTTP or JQuery in an async or sync way.

    github.com/.../CRMRESTBuilder

  • MattB-MSFT Profile Picture
    on at

    All public SDK Calls in CRM SDK ( aside from Imports and Explicit async job types ) are synchronous.

    Which API message / action are you looking at?

    MattB.

  • Verified answer
    tw0sh3ds Profile Picture
    5,600 on at

    You mean webAPI? It's up to you how you call them, you specify this as last parameter in open() function of your XMLHttpRequest:

    var req = new XMLHttpRequest();

    req.open("POST", "url", true/false);

    if you are reffering to OrganizationService - you can't call it asynchronously, but you can always make your call in a separate thread, for example:

    private async Task MakeRequest()

    {

     // do some stuff

     var task = Task.Run(() => CallWebService(myInput));

     // do other stuff

     var myOutput = await task;

     // some more stuff

    }

  • Suggested answer
    Dynamics_Alok Profile Picture
    1,746 on at

    Yes ..You can convert to Synchronous call using Thread or Task.

    Call your API in a Task and wait for completion or Call your API in a Thread and join it .

    It will wait till completion of method execution.

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 > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans