0

Firstly, our crm 2011 is on-premise. Then change to IFD(https://myservername.mycompany.com/ORGName/XRMServices/2011/Organization.svc). when change to IFD, all OData and javascript are not working.

In on-premise, we use for server url...
var lvSz_CRMServerURL = Xrm.Page.Context.getServerUrl(); it is working fine for OData and JS.

In IFD,we use for server url..

var lvSz_CRMODataSvcURLEndpoint = Xrm.Page.context.prependOrgName("/XRMServices/2011/OrganizationData.svc"); Odata and JS function are not working and cannot access.

when use prependOrgName and lvObj_XMLDocHnd2.open("GET", lvSz_ODataQueryURL, true), lvObj_XMLDocHnd2.readyState is 1.(should be 4)

when use prependOrgName and lvObj_XMLDocHnd2.open("GET", lvSz_ODataQueryURL, false), lvObj_XMLDocHnd2.readyState is 4 but lvObj_XMLDocHnd2.status is 404(should be 200). So OData and JS are stopped and not going through the checking.

Please give me any suggestion. what is wrong that may be configuration or JS function.

Please take a look my OData and JS function

.....

function JS_GenerateQuotation() {
//debugger;
var opportunityId = Xrm.Page.data.entity.getId(); //Xrm.Page.getAttribute("new_opportunityid").getValue()[0].id;
var prepareQuotation;

//var lvSz_CRMServerURL = rootURL + "/GBGroupUAT"; 
//var lvSz_CRMODataSvcURLEndpoint = lvSz_CRMServerURL + "/XRMServices/2011/OrganizationData.svc";

var lvSz_CRMODataSvcURLEndpoint = Xrm.Page.context.prependOrgName("/XRMServices/2011/OrganizationData.svc");

var lvObj_XMLDocHnd2 = null;
lvObj_XMLDocHnd2 = new XMLHttpRequest();

var relatedEntity = "opportunity";
var lvSz_ODataQueryURL = lvSz_CRMODataSvcURLEndpoint + ((relatedEntity == "opportunity") ? "/OpportunitySet?$select=new_PrepareQuotation&$filter=OpportunityId eq guid'" + opportunityId + "'" : "");

lvObj_XMLDocHnd2.open("GET", lvSz_ODataQueryURL, false);
lvObj_XMLDocHnd2.setRequestHeader("Accept", "application/json");
lvObj_XMLDocHnd2.setRequestHeader("Content-Type", "application/json; charset=utf-8");
var lvArr_CRMRecordsMatchingSpecifiedGUID;

lvObj_XMLDocHnd2.onreadystatechange = function () {
    if (lvObj_XMLDocHnd2.readyState == 4) {
        if (lvObj_XMLDocHnd2.status == 200) {

            lvArr_CRMRecordsMatchingSpecifiedGUID = eval('(' + lvObj_XMLDocHnd2.responseText + ')');

            if (lvArr_CRMRecordsMatchingSpecifiedGUID == null || lvArr_CRMRecordsMatchingSpecifiedGUID == "" || lvArr_CRMRecordsMatchingSpecifiedGUID.d.results[0] == null) {

            }
            else {
                prepareQuotation = lvArr_CRMRecordsMatchingSpecifiedGUID.d.results[0].new_PrepareQuotation;
            }
        }
    }
}
lvObj_XMLDocHnd2.send();

if (prepareQuotation != false) {
    var GUIDvalue = Xrm.Page.data.entity.getId();

    var serverUrl = urlGenerateQuotation + GUIDvalue;

    var features = "location=no,menubar=no,status=no,toolbar=no,resizable=1";
    window.open(serverUrl, "_blank", features);
}
else {
    alert("Please prepare quotation.");
}

}

2
  • may i know which roll up version? actually, we have Infra team(hardware) so i am not sure that they already installed or not. Please let me know which rollup we need to install. Thanks Commented Apr 2, 2014 at 10:50
  • rollup12 contains a method called getClientUrl msdn.microsoft.com/en-us/library/… that normally fixes this kind of issues Commented Apr 2, 2014 at 11:44

1 Answer 1

0

IFD OData endpoints should look like this: https://orgname.domain/XRMServices/2011/OrganizationData.svc

You can read the correct URL under Settings -> Customizations -> Developer Resources

From UR12 onwards you should use Xrm.Page.context.getClientUrl() which superseeds Xrm.Page.context.getServerUrl() to get the base url for the organization.

Sign up to request clarification or add additional context in comments.

3 Comments

thank you so much for your help. As suggested, i use getClientURL() var lvSz_CRMServerURL = Xrm.Page.context.getClientUrl(); var lvSz_CRMODataSvcURLEndpoint = lvSz_CRMServerURL + "/XRMServices/2011/OrganizationData.svc"; but lvObj_XMLDocHnd2.readyState is 4 but lvObj_XMLDocHnd2.status is 404(should be 200). I also check the CRM server rollup version is rollup 16. Please give me any suggestion to solve this issue.
Hi all, now i found one different. when i use Xrm.Page.context.getClientUrl(), the url is "bn.aa.com.sg/Group" (this is same on-premise url link before change to IFD). when i use Xrm.Page.context.getServerUrl(), the url is "crmuat.aa.com/Group". when i check in Developer resources, the url is "crmuat.aa.com/Group" that same to getServerUrl(). I also confuse how to use OData and JS.(Note url is sample link that is confidential). Thanks.
IFD url shouldn't be like "domain/organization" (i.e. the same as before IFD setup), I strongly suspect something's off in your IFD/ADFS configuration (I'm not familiar with the steps involved though, I'll leave to someone with more in-depth expertise to address that...)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.