[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 149
  • Last Modified:

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

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
apollo7
Asked:
apollo7
  • 4
  • 2
1 Solution
 
Feridun KadirPrincipal ConsultantCommented:
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
 
apollo7Author 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.
0
 
apollo7Author 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

0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
Feridun KadirPrincipal ConsultantCommented:
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
 
apollo7Author Commented:
Thanks,will give this a try
0
 
apollo7Author Commented:
Thanks for the syntax correct, needed that for the functions to run
0

Featured Post

 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now