Solved

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

Posted on 2016-09-06
6
72 Views
Last Modified: 2016-09-28
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
0
Comment
Question by:apollo7
  • 4
  • 2
6 Comments
 
LVL 29

Expert Comment

by:Feridun Kadir
ID: 41786894
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.
0
 
LVL 1

Author Comment

by:apollo7
ID: 41787641
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.
0
 
LVL 1

Author Comment

by:apollo7
ID: 41788015
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

0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 29

Accepted Solution

by:
Feridun Kadir earned 500 total points
ID: 41794521
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.
0
 
LVL 1

Author Comment

by:apollo7
ID: 41794547
Thanks,will give this a try
0
 
LVL 1

Author Closing Comment

by:apollo7
ID: 41819663
Thanks for the syntax correct, needed that for the functions to run
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question