CRM 2011 On Premise / http connection working / https connection not working

apollo7
apollo7 used Ask the Experts™
on
Hi

I created a ribbon button that calls a JavaScript function with several sections.  The button/JavaScript works when connected in-house to the CRM server using http - but when connected using https some parts of the function work but others do not.

The function fills in a quote with pre-selected values to enable the user to quickly populate a quote.  JavaScript that populates lookup values from systemuser works in both http and https - JavaScript that populates optionsets only work using an http connection.

I am confused by this and have tried reworking the code.  I have also checked the browser versions, security settings on the https browser but I am not making any progress.

Does someone have an idea of what could be causing this?

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Feridun KadirPrincipal Consultant

Commented:
The first thing to point out is that CRM does not support use of http and https bindings for the website at the same time (even though IIS does). You can either use http or https but not both.  

I'm not suggesting that this is definitely the cause of your problem but it might be and it is something that you should address in any case. Have you configured IFD (I'm guessing that you have given you have an https binding)?  If so, then you should remove the http binding and also ensure that the CRM web properties in Deployment manager are configured correctly.

Author

Commented:
Here is what I have:   I have dev, test and production servers that I connect to using RDP.  I use Visual Studio on the CRM servers to develop code and SSRS reports.  In this environment, I use a http address (no certificate) when I open CRM 2011.

We also have an IFD that users and testers use to access CRM, this is an https address with a SSL certificate to provide security over the internet.

Is this configuration incorrect?  I was not involved in setting up CRM so I am not sure what was decided at the time.  Also, I have made numerous customizations, plugins, client side code, etc that work for both my dev environment and the IFD, this is the first change that works differently on the IFD and the internal CRM servers.

Thanks for your help.

Author

Commented:
New development, I have all the fields populated from the IFD https address except the current user.  I am using ODATA and wonder if this could be the problem.  The user fields are also read-only so I tried setting diabled to false, populate code, then set back to disabled back to true.  This did not make a difference.

The code I am using to get and set the current user is below.  It works if I am on the CRM server but not logged in as an IFD user

function GetItcUser() {
    var context;
    var serverUrl;
    var UserID;
    var ODataPath;
    context = Xrm.Page.context;
    serverUrl = context.getServerUrl();
    UserID = context.getUserId();
    ODataPath = serverUrl + "/XRMServices/2011/OrganizationData.svc";
    var retrieveUserReq1 = new XMLHttpRequest();
    retrieveUserReq1.open("GET", ODataPath + "/SystemUserSet(guid'" + UserID + "')", true);
    retrieveUserReq1.setRequestHeader("Accept", "application/json");
    retrieveUserReq1.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    retrieveUserReq1.onreadystatechange = function () {
        retrieveUserReqCallBack(this);
    };
    retrieveUserReq1.send();
}
function retrieveUserReqCallBack(retrieveUserReq1) {
    if (retrieveUserReq1.readyState == 4 /* complete */) {

        if (retrieveUserReq1.status == 200) {
            var retrievedUser = this.parent.JSON.parse(retrieveUserReq1.responseText).d;
            if (retrievedUser.FullName != null)

                var setUservalue = new Array();
            setUservalue[0] = new Object();
            setUservalue[0].id = Xrm.Page.context.getUserId();
            setUservalue[0].entityType = 'systemuser';
            setUservalue[0].name = retrievedUser.FullName;
            Xrm.Page.ui.controls.get("csc_itcuser").setDisabled(false);
            Xrm.Page.getAttribute("csc_itcuser").setValue(setUservalue)
            Xrm.Page.getAttribute("csc_itcuser").setSubmitMode("always");
        }
    }
}

Open in new window

Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Principal Consultant
Commented:
Sorry for the delay. One thing you should do in your Javascript is change context.getServerUrl() to context.getClientUrl().  Microsoft removed getServerUrl in CRM 2013. This article has more details https://msdn.microsoft.com/library/gg334511(v=crm.5).aspx#BKMK_getServerUrl

With regard to your previous post regarding environments, the rule is for a single deployment (that is an installation of CRM, but possibly multiple databases), enabling http and https is not supported.  But if your environments are actually separate deployments, then each deployment can be different.  You mention servers in the plural so you might have several deployments, but it might also be that you several CRM servers within one deployment so I can't tell.

Correcting the JavaScript might do the trick.

Author

Commented:
Thanks,will give this a try

Author

Commented:
Thanks for the syntax correct, needed that for the functions to run

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial