Solved

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

Posted on 2016-09-06
6
53 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 29

Accepted Solution

by:
feridun earned 500 total points
Comment Utility
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
Comment Utility
Thanks,will give this a try
0
 
LVL 1

Author Closing Comment

by:apollo7
Comment Utility
Thanks for the syntax correct, needed that for the functions to run
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now