locked
Fetching CRM 2011 Data using Client side script in a custom page RRS feed

  • Question

  • I have a requirement to create a custom page which pulls the data from CRM and displays in the page, calling the CRM API should happen on the client side(java script). This page will be running under the CRM user(whose credentials will be captured before), I tried to use the fetchxml the way we use in the web resources with couple of modifications, but am getting Access denied error.
      Is there any way to achieve this? I have idea on how to do this using the server side code, but we need it client side script.
    This page will not be running under CRM context.

    Regards

    Jeevan


    Regards Jeevan Please vote for me if you find the answer is useful.

    Thursday, September 25, 2014 7:30 AM

All replies

  • Hi Jeevan,

    You should be able to use the REST interface if you are running the calls with a logged in user. In CRM 2011 you can't authenticate against the REST interface so you need to have a user which credentials already are correct. It's a bit of a hassle to get the REST calls and result in place the first couple of times you use it but I've really come to like the flexibility.

    I made a post about the REST interface on my blog, which is a bit dated and also my first tries with the thing so there are probably better ones out there now, I still use it for reference though and if you change the server id-calls it will work.

    Good luck


    Rickard Norström Developer CRM-Konsulterna
    http://www.crmkonsulterna.se
    Swedish Dynamics CRM Forum: http://www.crmforum.se
    My Blog: http://rickardnorstrom.blogspot.se

    Thursday, September 25, 2014 8:40 AM
  • I missed to add, we are using REST already in couple of scenarios, but for some scenarios we have challenges building the queries as there are limitations with ODATA queries. One of them is like having filter on Related entity plus a filter on the primary entity. I couldn't find a way to write a query for this scenario, I may have to write some complex conditions.

    So I was thinking to use fetchxml which has more options to build queries. But I am having this issue with that.


    Regards Jeevan Please vote for me if you find the answer is useful.

    Thursday, September 25, 2014 8:51 AM
  • Do you have any trace logs from CRM or any other logs? What sort of code do you have to make the FetchXML-call? I'm not a big fan of using hand writte soapcalls in JS myself so I haven't done that sort of scripting much, especially since the REST interface of 2011 was introduced.

    Regards


    Rickard Norström Developer CRM-Konsulterna
    http://www.crmkonsulterna.se
    Swedish Dynamics CRM Forum: http://www.crmforum.se
    My Blog: http://rickardnorstrom.blogspot.se

    Thursday, September 25, 2014 9:48 AM