Monday, October 24, 2016

Load Javascript in the Ribbon Function MSCRM

Hi All,

Please find the below code to load the Javascript

Call the Below Function as

LoadWebResource("email.js");


function LoadWebResource(resource) {
    var httpRequest = null;
    try {
        if (window.XMLHttpRequest) {  // code for IE7+, Firefox, Chrome, Opera, Safari
            httpRequest = new XMLHttpRequest();
        }
        else {  // code for IE6, IE5
            httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
        }
        var serverUrl = Xrm.Page.context.getClientUrl();
        if (serverUrl.match(/\/$/)) {
            serverUrl = serverUrl.substring(0, serverUrl.length - 1);
        }
        httpRequest.open("GET", serverUrl + "/webresources/" + resource, false);
        httpRequest.send(null);
        eval(httpRequest.responseText);
    }
    catch (e) {
        alert("LoadWebResource >> Error loading " + resource + ":\n" + e.description);
    }
}

No comments:

Post a Comment

Day 11 - Customizing Option Sets Dropdown Fields with JavaScript

  In this Blog, we will see how to Customizing Option Sets Dropdown Fields with JavaScript label1 = formContext.getAttribute( "bosch_op...