Fetch Metadata in CRM 2011 using javascript synchronously

dynamics-crm-2011, javascript, metadata, synchronous

Solution

In the SDK, in the samplecode\js\soapforjscript\soapforjscript\scripts\sdk.metadata.js file there are RetrieveAllEntitiesAsync, RetrieveEntityAsync, and RetrieveAttributeAsync examples. To make synchronous, change the third parameter of the `req.open` statements to `false`. Then you can remove the `onreadystatechange` handler and handle the response immediately after the `req.send(request);` statement.

Problem

Is there any way to fetch metadata from CRM 2011 using javascript in a synchronous manner? If it is, could someone please hit me up with some sample code present in the SDK (I couldn't find it) or maybe your own code? Thanks.

Original source