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

How to Run Microsoft Flow for Every one Month

Introduction: In this Blog we will see how to Run Microsoft Flow for Every one Month. Implementation Steps:   1. Navigate to  https://make.p...