web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Using a web resource to call an external web service

(1) ShareShare
ReportReport
Posted on by

I have a requirement to call an external web service from within a CRM Online form. The call would have to include the data on the form. Is that possible with a web resource?

Also can the web resource be added to the form so the user could just push a button?

Thanks, Gary

*This post is locked for comments

I have the same question (0)
  • Royal King Profile Picture
    27,686 on at
    RE: Using a web resource to call an external web service

    I would recommend creating Custom action to make call to external web service to retrieve information. As you can call custom action in javascript, workflows and plugin's. As well you dont have to change anything in the calling code if you have to make any cnhanges in the web service call.

  • Community Member Profile Picture
    on at
    RE: Using a web resource to call an external web service

    Dear Natraj'

    I have utilized your JSONP solution to make a cross-domain http request to a web service.

    But problem I am facing is that the call back method in the JSONP request is not executed.

    This JavaScript is written in a js WebResource and the method is hooked to onclick event of a ribbon button.I have tested the request successfully in firebug i.e. when I click the ribbon button a request is generated to the mentioned web-service and a response is also received without any error, but I am unable to see the alert from the callback method.

    Kindly guide me how I am supposed to resolve this issue, or is there any other way ton achieve this target. Following is the code for my web resource.

    function getContactId() {
                    var no = Xrm.Page.getAttribute("mobilephone").getValue();
                    var url = 'http://10.10.10.129:85/CustomersService.svc/Getid?id=' + no + '&dealWithJSON';
                    var script = document.createElement('script');
                    script.src = url;
                    document.body.appendChild(script);
    }
    function dealWithJSON(json) {
                        alert(json);
    }


  • Suggested answer
    NatrajY Profile Picture
    3,040 on at
    RE: Using a web resource to call an external web service

    You could query an external Webservice using stock standard Javascript, or use jQuery or a library of you choice to facilitate the request. This can be triggered by clicking a button. However, if the webservice is hosted on a different domain, you'll run into cross domain issues and you can either using JSONP or CORS to overcome this.

    Another option is to use a combination of JS and Actions, which would be little easier that pure JS alone. Have a look at salimadamoncrm.com/.../crm-2013-actions-to-get-around-javascript-cross-domain-challenges. You'll still be able to call this action from a button on the ribbon. This would be my preferred option in CRM2013.

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#2
Christoph Pock Profile Picture

Christoph Pock 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans