locked
CRM 2011 getJson Rest endpoint not working after importing organization RRS feed

  • Question

  • Hi everyone,

    I took a back up of my dev database and restored it on a new SQL server for my staging environment and also performed import organization on a new staging CRM server from this database.

    Everything seems to be working fine but except the JavaScript web resources that makes use of $.getJson function along with the Rest end point (Organizationdata.svc). I had the script registered for the onclick event on look up control which automatically populates other text fields on the form. 

    Once it is successful I've some code inside the getJson function that never gets executed and I also have the callback function for failure which is never executed too and everything just freezes up.

    The interesting thing is I'm also using XrmServiceToolkit(codeplex) in some of my web resources which are perfectly working in the new environment

    Can someone help me in troubleshooting this issue?

    Environment: IE8, CRM 2011 On-premise, Update Roll up 10, Jquery 1.7

    Thursday, December 6, 2012 4:27 AM

Answers

  • This actually took care of it in getting those getJson calls to work again.

    Xrm.Page.context.prependOrgName("/xrmservices/2011/organizationdata.svc")

    • Marked as answer by crmsurfer Monday, December 10, 2012 4:47 AM
    Monday, December 10, 2012 4:47 AM

All replies

  • may be the url has been change check it once in the organisation check it once

    debug the script

    in script use ---Xrm.Page.context.getServerUrl(); it will retrieve the server url

    if you got any error plz paste here i will help you.


    ms crm

    Thursday, December 6, 2012 8:33 AM
  • Thanks Aushton for looking into it.

    Yes that's exactly(Xrm.Page.context.getServerUrl()) what am using in my Javascript along with rest endpoint. The way service URL's are configured in deployment manager are by making use of servername and not the hostname(IIS). I've manually copied the end point URL's in the browser and they seem to be working fine.

    Sample code and things I've tried. None of them seems to be working.

    //var url = Xrm.Page.context.getServerUrl() + "/xrmservices/2011/organizationdata.svc/ContactSet(guid'" + reportedbyId + "')";
    //var url = "http://IP Address" + "/orgname"+ "/xrmservices/2011/organizationdata.svc/ContactSet(guid'" + reportedbyId + "')";
    var url = "http://hostname(IIS)" + "/orgname"+ "/xrmservices/2011/organizationdata.svc/ContactSet(guid'" + reportedbyId + "')";
        alert(url);
        $.getJSON(url, function(d)
        {
                 Xrm.Page.data.entity.attributes.get("reportedbytitle").setValue(d.d.JobTitle);
             }, function(err)
         {
     alert(err);
        });

    Thursday, December 6, 2012 4:12 PM
  • This actually took care of it in getting those getJson calls to work again.

    Xrm.Page.context.prependOrgName("/xrmservices/2011/organizationdata.svc")

    • Marked as answer by crmsurfer Monday, December 10, 2012 4:47 AM
    Monday, December 10, 2012 4:47 AM