JavaScript Callbacks

If you need to access the response from an asynchronous XMLHttpRequest, provide your request with a callback. The code below retrieves a Contact from CRM by its ID. In the success function, a callback is called, passing it the result from the request (which should be the Contact).

To make use of the result, create a function to call getContact, and evaluate its result:

The callback is called once the response is ready. Notice that the callback function is passed anonymously here as the second parameter of the call to getContact. It is advisable to write this anonymous function separately and give it a name.

1 comment:

  1. HI Dave,

    Need your expertise inputs on the CallBack URL which can be used to receive the response from third party REST async service?
    The requirement is - we have a third party REST service which works Asynchronously. The request parameters for that service includes a callback URL along with other standard request parameters. Upon completion of request the response will sent back to Dynamics CRM via the CallBack URL.
    How we can get that CallBack URL? Any guidance on this is highly appreciated! Thanks in Advance.

    ReplyDelete