Customer Engagement & Dynamics CRM Forum

Expand all | Collapse all

Deprecated Java Script from Upgrade to Version 9.0

  • 1.  Deprecated Java Script from Upgrade to Version 9.0

    SILVER CONTRIBUTOR
    Posted Feb 28, 2019 09:42 AM
    Hi,

    My company recently upgraded to version 9.0 and we have some deprecated code on one of our forms (Quote Products). We are getting the error message below. If I copy and pasted the code on here, would anyone be able to help me figure out what needs to be updated so it's not deprecated anymore. Any insight is appreciated, I am by no means an expert in this.



    ------------------------------
    Jennifer Swanberg
    Customer Relations Specialist
    Itasca Consulting Group
    Minneapolis MN
    ------------------------------


  • 2.  RE: Deprecated Java Script from Upgrade to Version 9.0

    GOLD CONTRIBUTOR
    Posted Feb 28, 2019 10:00 AM
    Edited by Andrew Butenko Feb 28, 2019 10:00 AM
    Jennifer,
    Copy and paste, please. I believe someone will try to help you.

    ------------------------------
    Andrew Butenko
    ------------------------------



  • 3.  RE: Deprecated Java Script from Upgrade to Version 9.0

    SILVER CONTRIBUTOR
    Posted Feb 28, 2019 10:08 AM
    Thanks Andrew!

    Here is the code on our Quote Product form. Essentially, it should be calculating the total of the Product after all discounts have been applied (unit discount and Master Discounts).


    // JavaScript source code// JavaScript source codevar Xrm;

    var _masterDiscountList = [];var _eligibleDiscountList = [];
    /** Determine Total After All Discounts (TAAD) value for quote product */function totalAfterAllDiscountsQuote() {        "use strict";
        //resetting discount list    _masterDiscountList = [];    _eligibleDiscountList = [];
        //get the form type value    var formType = Xrm.Page.ui.getFormType();
        if (formType == 2) {        //Xrm.Page.getAttribute("icg_totalafteralldiscounts").setSubmitMode("always");        //Xrm.Page.getAttribute("icg_eligiblediscountvalue").setSubmitMode("always");        //Xrm.Page.getAttribute("new_eligiblediscountamt2").setSubmitMode("always"); //commented by PO since field doesn't exist on form
            getMasterDiscountList();        getEligibleDiscountList();
            calcTotals();    }}

    function getMasterDiscountList() {    var quoteId = getQuoteId();    var fetchXML = '<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">' +        '<entity name="wipfli_applieddiscounts">' +        '<attribute name="wipfli_applieddiscountsid" />' +        '<attribute name="wipfli_name" />' +        '<attribute name="createdon" />' +        '<attribute name="wipfli_masterdiscount" />' +        '<attribute name="wipfli_applieddiscountpercentage" />' +        '<order attribute="wipfli_name" descending="false" />' +        '<filter type="and">' +        '<condition attribute="wipfli_quote" operator="eq" uiname="Q-03644-V0F4" uitype="quote" value="' + quoteId + '" />' +        '</filter>' +        '</entity>' +        '</fetch>';
        var fetchXMLEncoded = encodeURI(fetchXML);    var params = "wipfli_applieddiscountses?fetchXml=" + fetchXMLEncoded;    getData(params, false, 'GET', function (result) {                for (var i = 0; i < result.value.length; i++) {            if (result.value[i] != null && result.value[i]["_wipfli_masterdiscount_value@OData.Community.Display.V1.FormattedValue"] != null && result.value[i].wipfli_applieddiscountpercentage != null) {                _masterDiscountList.push({ name: result.value[i]["_wipfli_masterdiscount_value@OData.Community.Display.V1.FormattedValue"], discount: result.value[i].wipfli_applieddiscountpercentage });            }        }    });
    }

    function getEligibleDiscountList() {    "use strict";
        var eligibleDiscounts = Xrm.Page.data.entity.attributes.get("wipfli_eligiblediscounts").getValue();
        if (eligibleDiscounts !== null) {        _eligibleDiscountList = eligibleDiscounts.split(", ");    } else {        _eligibleDiscountList = null;    }        //return eligibleDiscountArray;}

    function calcTotals() {    "use strict";
        var lineTotal, eligibleDiscountAmount, totalAfterAllDiscounts;
        lineTotal = Xrm.Page.data.entity.attributes.get("extendedamount").getValue();
        totalAfterAllDiscounts = parseFloat(GetQuoteDiscounts(lineTotal));    eligibleDiscountAmount = parseFloat(lineTotal - totalAfterAllDiscounts);
            Xrm.Page.getAttribute("icg_totalafteralldiscounts").setSubmitMode("always");    Xrm.Page.getAttribute("icg_eligiblediscountvalue").setSubmitMode("always");    Xrm.Page.getAttribute("icg_eligiblediscountvalue").setValue(eligibleDiscountAmount);    Xrm.Page.getAttribute("icg_totalafteralldiscounts").setValue(totalAfterAllDiscounts);    //Xrm.Page.getAttribute("icg_totalafteralldiscounts").setSubmitMode("dirty");    //Xrm.Page.getAttribute("icg_eligiblediscountvalue").setSubmitMode("dirty");    //Xrm.Page.data.entity.save();    //Xrm.Page.data.refresh(true);     //Xrm.Page.data.entity.attributes.get("icg_eligiblediscountvalue").setValue(eligibleDiscountAmount);    //Xrm.Page.data.entity.attributes.get("icg_totalafteralldiscounts").setValue(totalAfterAllDiscounts);}

    /** * Retrieve all applied discounts for master quote, check for  * eligibility against product, then return percentages for  * all eligible discounts *  * @param {number} lineTotal - Quote Product total after any unit discount * @returns {array} */
    function GetQuoteDiscounts(lineTotal) {    "use strict";
        var lineTaad, resultCount,        thisDiscountName, thisDiscountPct;
        lineTaad = lineTotal;
        for (var i = 0; i < _masterDiscountList.length; i++) {        thisDiscountName = _masterDiscountList[i].name;        if (checkDiscountEligibility(thisDiscountName, _eligibleDiscountList) === true) {            thisDiscountPct = _masterDiscountList[i].discount;            lineTaad = lineTaad * (1 - (thisDiscountPct / 100));        }    }
        return lineTaad;}

    /** Retrieve master Quote ID for this Quote Product */function getQuoteId() {    "use strict";    var Quote = Xrm.Page.data.entity.attributes.get("quoteid").getValue(),        quoteId = Quote[0].id;
        return quoteId;}
    /** * Retrieve all eligible discounts for quote product * @returns {array} */function getEligibleDiscounts() {
        "use strict";
        var eligibleDiscounts = Xrm.Page.data.entity.attributes.get("wipfli_eligiblediscounts").getValue(),        eligibleDiscountArray;
        if (eligibleDiscounts !== null) {        eligibleDiscountArray = eligibleDiscounts.split(", ");    } else {        eligibleDiscountArray = null;    }    return eligibleDiscountArray;}

    /**  * Check quote applied discount against all eligible discounts for product * @param {string} thisDiscount - The name of the discount being checked * @param {array} eligibleDiscounts - All eligible discounts for product */function checkDiscountEligibility(thisDiscount, eligibleDiscounts) {
        "use strict";    var discInArray = $.inArray(thisDiscount, eligibleDiscounts);    if (discInArray !== -1) {        return true;    } else {        return false;    }}

    //this method is designed to grab data from CRM using webapi callsfunction getData(parameters, async, method, callback, data) {    var url = parent.Xrm.Page.context.getClientUrl() + "/api/data/v8.2/";    url = url + parameters;
        var req = new XMLHttpRequest();    req.open(method, url, async);    req.setRequestHeader("Accept", "application/json");    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");    req.setRequestHeader("OData-MaxVersion", "4.0");    req.setRequestHeader("OData-Version", "4.0");    req.setRequestHeader("Prefer", "odata.include-annotations=*");    req.send();    if (async) {        req.onreadystatechange = function (data) {            if (req.readyState === 4)/*4 = Complete*/ {                if (req.status === 201 || req.status === 200)/*200 = OK*/ {                    var result = JSON.parse(req.response);                    callback(result, data);                }                else {                    Xrm.Utility.alertDialog(this.statusText);                }            }        };    } else {        if (req.readyState === 4)/*4 = Complete*/ {            if (req.status === 201 || req.status === 200)/*200 = OK*/ {                var result = JSON.parse(req.response);                callback(result, data);            }            else {                Xrm.Utility.alertDialog(this.statusText);            }        }    }}

    ------------------------------
    Jennifer Swanberg
    Customer Relations Specialist
    Itasca Consulting Group
    Minneapolis MN
    ------------------------------



  • 4.  RE: Deprecated Java Script from Upgrade to Version 9.0

    GOLD CONTRIBUTOR
    Posted Feb 28, 2019 10:44 AM
    Try to use following code:

    var _masterDiscountList = [];
    var _eligibleDiscountList = [];
    /** Determine Total After All Discounts (TAAD) value for quote product */
    function totalAfterAllDiscountsQuote() {
        "use strict";
        //resetting discount list    _masterDiscountList = [];    _eligibleDiscountList = [];
        //get the form type value    var formType = Xrm.Page.ui.getFormType();
        if (formType == 2) { //Xrm.Page.getAttribute("icg_totalafteralldiscounts").setSubmitMode("always");        //Xrm.Page.getAttribute("icg_eligiblediscountvalue").setSubmitMode("always");        //Xrm.Page.getAttribute("new_eligiblediscountamt2").setSubmitMode("always"); //commented by PO since field doesn't exist on form
            getMasterDiscountList();
            getEligibleDiscountList();
            calcTotals();
        }
    }
    
    function getMasterDiscountList() {
        var quoteId = getQuoteId();
        var fetchXML = '<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">' + '<entity name="wipfli_applieddiscounts">' + '<attribute name="wipfli_applieddiscountsid" />' + '<attribute name="wipfli_name" />' + '<attribute name="createdon" />' + '<attribute name="wipfli_masterdiscount" />' + '<attribute name="wipfli_applieddiscountpercentage" />' + '<order attribute="wipfli_name" descending="false" />' + '<filter type="and">' + '<condition attribute="wipfli_quote" operator="eq" uiname="Q-03644-V0F4" uitype="quote" value="' + quoteId + '" />' + '</filter>' + '</entity>' + '</fetch>';
        var fetchXMLEncoded = encodeURI(fetchXML);
        var params = "wipfli_applieddiscountses?fetchXml=" + fetchXMLEncoded;
        getData(params, false, 'GET', function(result) {
            for (var i = 0; i < result.value.length; i++) {
                if (result.value[i] != null && result.value[i]["_wipfli_masterdiscount_value@OData.Community.Display.V1.FormattedValue"] != null && result.value[i].wipfli_applieddiscountpercentage != null) {
                    _masterDiscountList.push({
                        name: result.value[i]["_wipfli_masterdiscount_value@OData.Community.Display.V1.FormattedValue"],
                        discount: result.value[i].wipfli_applieddiscountpercentage
                    });
                }
            }
        });
    }
    
    function getEligibleDiscountList() {
        "use strict";
        var eligibleDiscounts = Xrm.Page.data.entity.attributes.get("wipfli_eligiblediscounts").getValue();
        if (eligibleDiscounts !== null) {
            _eligibleDiscountList = eligibleDiscounts.split(", ");
        } else {
            _eligibleDiscountList = null;
        } //return eligibleDiscountArray;}
    
        function calcTotals() {
            "use strict";
            var lineTotal, eligibleDiscountAmount, totalAfterAllDiscounts;
            lineTotal = Xrm.Page.data.entity.attributes.get("extendedamount").getValue();
            totalAfterAllDiscounts = parseFloat(GetQuoteDiscounts(lineTotal));
            eligibleDiscountAmount = parseFloat(lineTotal - totalAfterAllDiscounts);
            Xrm.Page.getAttribute("icg_totalafteralldiscounts").setSubmitMode("always");
            Xrm.Page.getAttribute("icg_eligiblediscountvalue").setSubmitMode("always");
            Xrm.Page.getAttribute("icg_eligiblediscountvalue").setValue(eligibleDiscountAmount);
            Xrm.Page.getAttribute("icg_totalafteralldiscounts").setValue(totalAfterAllDiscounts); //Xrm.Page.getAttribute("icg_totalafteralldiscounts").setSubmitMode("dirty");    //Xrm.Page.getAttribute("icg_eligiblediscountvalue").setSubmitMode("dirty");    //Xrm.Page.data.entity.save();    //Xrm.Page.data.refresh(true);     //Xrm.Page.data.entity.attributes.get("icg_eligiblediscountvalue").setValue(eligibleDiscountAmount);    //Xrm.Page.data.entity.attributes.get("icg_totalafteralldiscounts").setValue(totalAfterAllDiscounts);}
    
            /** * Retrieve all applied discounts for master quote, check for  * eligibility against product, then return percentages for  * all eligible discounts *  * @param {number} lineTotal - Quote Product total after any unit discount * @returns {array} */
            function GetQuoteDiscounts(lineTotal) {
                "use strict";
                var lineTaad, resultCount, thisDiscountName, thisDiscountPct;
                lineTaad = lineTotal;
                for (var i = 0; i < _masterDiscountList.length; i++) {
                    thisDiscountName = _masterDiscountList[i].name;
                    if (checkDiscountEligibility(thisDiscountName, _eligibleDiscountList) === true) {
                        thisDiscountPct = _masterDiscountList[i].discount;
                        lineTaad = lineTaad * (1 - (thisDiscountPct / 100));
                    }
                }
                return lineTaad;
            }
    
            /** Retrieve master Quote ID for this Quote Product */
            function getQuoteId() {
                "use strict";
                var Quote = Xrm.Page.data.entity.attributes.get("quoteid").getValue(),
                    quoteId = Quote[0].id;
                return quoteId;
            }
            /** * Retrieve all eligible discounts for quote product * @returns {array} */
            function getEligibleDiscounts() {
                "use strict";
                var eligibleDiscounts = Xrm.Page.data.entity.attributes.get("wipfli_eligiblediscounts").getValue(),
                    eligibleDiscountArray;
                if (eligibleDiscounts !== null) {
                    eligibleDiscountArray = eligibleDiscounts.split(", ");
                } else {
                    eligibleDiscountArray = null;
                }
                return eligibleDiscountArray;
            }
    
    	
            /**  * Check quote applied discount against all eligible discounts for product * @param {string} thisDiscount - The name of the discount being checked * @param {array} eligibleDiscounts - All eligible discounts for product */
            function checkDiscountEligibility(thisDiscount, eligibleDiscounts) {
                "use strict";
                var discInArray = eligibleDiscounts.indexOf(thisDiscount);
                if (discInArray !== -1) {
                    return true;
                } else {
                    return false;
                }
            }
    
            //this method is designed to grab data from CRM using webapi callsfunction getData(parameters, async, method, callback, data) {    var url = parent.Xrm.Page.context.getClientUrl() + "/api/data/v8.2/";    url = url + parameters;
            var req = new XMLHttpRequest();
            req.open(method, url, async);
            req.setRequestHeader("Accept", "application/json");
            req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
            req.setRequestHeader("OData-MaxVersion", "4.0");
            req.setRequestHeader("OData-Version", "4.0");
            req.setRequestHeader("Prefer", "odata.include-annotations=*");
            req.send();
            if (async) {
                req.onreadystatechange = function(data) {
                    if (req.readyState === 4) /*4 = Complete*/ {
                        if (req.status === 201 || req.status === 200) /*200 = OK*/ {
                            var result = JSON.parse(req.response);
                            callback(result, data);
                        } else {
                            Xrm.Utility.alertDialog(this.statusText);
                        }
                    }
                };
            } else {
                if (req.readyState === 4) /*4 = Complete*/ {
                    if (req.status === 201 || req.status === 200) /*200 = OK*/ {
                        var result = JSON.parse(req.response);
                        callback(result, data);
                    } else {
                        Xrm.Utility.alertDialog(this.statusText);
                    }
                }
            }
        }


    ------------------------------
    Andrew Butenko
    ------------------------------



  • 5.  RE: Deprecated Java Script from Upgrade to Version 9.0

    SILVER CONTRIBUTOR
    Posted Feb 28, 2019 11:56 AM
    Thanks for the help Andrew! I really appreciate it. Unfortunately, I am still getting the error message.


    There is another script on this form but only onsave not onload. Would it be helpful to look at that too?

    Jenn

    ------------------------------
    Jennifer Swanberg
    Customer Relations Specialist
    Itasca Consulting Group
    Minneapolis MN
    ------------------------------



  • 6.  RE: Deprecated Java Script from Upgrade to Version 9.0

    GOLD CONTRIBUTOR
    Posted Feb 28, 2019 12:27 PM
    Ok. Now I see it.
    Replace line
    _eligibleDiscountList = null;
    with line
    _eligibleDiscountList = [];


    ------------------------------
    Andrew Butenko
    ------------------------------



  • 7.  RE: Deprecated Java Script from Upgrade to Version 9.0

    SILVER CONTRIBUTOR
    Posted Feb 28, 2019 02:36 PM
    Thanks again Andrew! I'm still receiving that same error message as in my previous message.

    ------------------------------
    Jennifer Swanberg
    Customer Relations Specialist
    Itasca Consulting Group
    Minneapolis MN
    ------------------------------



  • 8.  RE: Deprecated Java Script from Upgrade to Version 9.0

    GOLD CONTRIBUTOR
    Posted Feb 28, 2019 02:49 PM
    It's a bit hard to do that kind of troubleshooting without access to instance itself. I created a video that can explain basic principles of troubleshooting and can be helpful for you:


    ------------------------------
    Andrew Butenko
    ------------------------------



  • 9.  RE: Deprecated Java Script from Upgrade to Version 9.0

    GOLD CONTRIBUTOR
    Posted Mar 01, 2019 07:50 AM
    Your desktop space is too clean...  Can't focus on what you're saying ;)

    ------------------------------
    Daryl LaBar
    President, MVP
    Gap Integrity
    Fishers IN
    ------------------------------



  • 10.  RE: Deprecated Java Script from Upgrade to Version 9.0

    Posted Mar 01, 2019 08:58 AM
    The error seems to indicate the problem may be with browser support.  If you are using IE, have you tried opening CRM in a different browser such as Chrome or FireFox?  If it works in another browser, try adding this code to the very top of your script:

    // Production steps of ECMA-262, Edition 5, 15.4.4.14 // Reference: http://es5.github.io/#x15.4.4.14 if (!Array.prototype.indexOf) { Array.prototype.indexOf = function(searchElement, fromIndex) { var k; // 1. Let o be the result of calling ToObject passing // the this value as the argument. if (this == null) { throw new TypeError('"this" is null or not defined'); } var o = Object(this); // 2. Let lenValue be the result of calling the Get // internal method of o with the argument "length". // 3. Let len be ToUint32(lenValue). var len = o.length >>> 0; // 4. If len is 0, return -1. if (len === 0) { return -1; } // 5. If argument fromIndex was passed let n be // ToInteger(fromIndex); else let n be 0. var n = fromIndex | 0; // 6. If n >= len, return -1. if (n >= len) { return -1; } // 7. If n >= 0, then Let k be n. // 8. Else, n<0, Let k be len - abs(n). // If k is less than 0, then let k be 0. k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); // 9. Repeat, while k < len while (k < len) { // a. Let Pk be ToString(k). // This is implicit for LHS operands of the in operator // b. Let kPresent be the result of calling the // HasProperty internal method of o with argument Pk. // This step can be combined with c // c. If kPresent is true, then // i. Let elementK be the result of calling the Get // internal method of o with the argument ToString(k). // ii. Let same be the result of applying the // Strict Equality Comparison Algorithm to // searchElement and elementK. // iii. If same is true, return k. if (k in o && o[k] === searchElement) { return k; } k++; } return -1; }; }


    ------------------------------
    Pheng Yang
    Sr. Programmer Analyst
    Edina Realty
    Edina MN
    ------------------------------



  • 11.  RE: Deprecated Java Script from Upgrade to Version 9.0

    SILVER CONTRIBUTOR
    Posted Mar 01, 2019 09:43 AM
    Thanks Pheng! I'm getting the error in both IE and Chrome. There is another script on this form but only onsave not onload. Would it be helpful to look at that too?

    Here are two videos. In one video, I don't get any error message. In the second, I take the exact same steps but receive the error message. Do you know why it would behave differently from one minute to the next?

    ------------------------------
    Jennifer Swanberg
    Customer Relations Specialist
    Itasca Consulting Group
    Minneapolis MN
    ------------------------------



  • 12.  RE: Deprecated Java Script from Upgrade to Version 9.0

    Posted Mar 01, 2019 10:44 AM
    Yes, please post the code for the onsave event for the your Quote Product entity's Information form.  It looks like that is when you are encountering the error, even though the error dialog seems to indicate it is on the onload event.

    ------------------------------
    Pheng Yang
    Sr. Programmer Analyst
    Edina Realty
    Edina MN
    ------------------------------



  • 13.  RE: Deprecated Java Script from Upgrade to Version 9.0

    SILVER CONTRIBUTOR
    Posted Mar 01, 2019 12:20 PM
      |   view attached
    Sorry, I was wrong. This code is only OnLoad, not OnSave



    ------------------------------
    Jennifer Swanberg
    Customer Relations Specialist
    Itasca Consulting Group
    Minneapolis MN
    ------------------------------

    Attachment(s)

    txt
    Quote Product Main.txt   35K 1 version


  • 14.  RE: Deprecated Java Script from Upgrade to Version 9.0

    TOP CONTRIBUTOR
    Posted Mar 01, 2019 09:45 AM
    Edited by Rex Kenley Tan Mar 01, 2019 09:46 AM

    My suggestion is to refactor the code and use es6, especially since you're on Crm365 v9.

    1.) You only need 1 "use strict"; and that goes to the top of the file
    2.) Stop using var, let and const are better suited and don't suffer from variable hoisting
    3.) Use the webApi and utilize OData. fetchXml is a pain.
    4.) Use literals. People don't realize that there is an actual computing cost when appending or "+" strings together.
    5.) Use forEach instead of for
    6.) Use falsy, same reason as point 4
    7.) Use a variable instead of constantly drilling down to the property from the object
    8.) Use async to prevent locks when getting data
    9.) Try to avoid functions within a function

    You can use jsHint and jsLint to check your code further.

    Cheers!

    Ps. And I think I found your error using jshint

    Line 43: If a strict mode function is executed using function invocation, its 'this' value will be undefined.

    ​​

    ------------------------------
    Rex Kenley Tan, MCP
    Tallmadge OH
    https://www.youracclaim.com/users/rex-kenley-tan

    *Always be CURRENT with JavaScript & C#, NEVER be obsolete.

    DISCLAIMER: All views expressed on this site are my own and DO NOT represent the opinions of ANY entity whatsoever with which I have been, am now, or will be affiliated.
    ------------------------------



  • 15.  RE: Deprecated Java Script from Upgrade to Version 9.0

    SILVER CONTRIBUTOR
    Posted Mar 01, 2019 09:57 AM
    Wow Rex! Thanks for your feedback, I really appreciate it. I am by no means a developer so I'm not entirely what to do with this information. I used jshint and found the error that you mentioned but I unfortunately don't know how to fix it.

    ------------------------------
    Jennifer Swanberg
    Customer Relations Specialist
    Itasca Consulting Group
    Minneapolis MN
    ------------------------------



  • 16.  RE: Deprecated Java Script from Upgrade to Version 9.0

    TOP CONTRIBUTOR
    Posted Mar 01, 2019 10:01 AM

    Jennifer

    Try removing all "use strict".



    ------------------------------
    Rex Kenley Tan, MCP
    Tallmadge OH
    https://www.youracclaim.com/users/rex-kenley-tan

    *Always be CURRENT with JavaScript & C#, NEVER be obsolete.

    DISCLAIMER: All views expressed on this site are my own and DO NOT represent the opinions of ANY entity whatsoever with which I have been, am now, or will be affiliated.
    ------------------------------



  • 17.  RE: Deprecated Java Script from Upgrade to Version 9.0

    SILVER CONTRIBUTOR
    Posted Mar 01, 2019 10:24 AM
    Hi Rex,

    I'm still getting the error message even though I've removed all the "use strict".

    Jenn

    ------------------------------
    Jennifer Swanberg
    Customer Relations Specialist
    Itasca Consulting Group
    Minneapolis MN
    ------------------------------



  • 18.  RE: Deprecated Java Script from Upgrade to Version 9.0

    Posted Mar 05, 2019 09:47 AM
    ​You can try using XrmToolbox.  Use the plugin called, "Dynamics 365 V9 JavaScript Validator"  When you run this plugin it will grab all of the java scripts, and then find the ones that have code that is deprecated and it will tell you what you need to do to replace the code.  I see that you are using Xrm.page in your script.  This code is deprecated in V9.  You need to replace that with ExecutionContext.getFormContext

    Hope that helps.

    ------------------------------
    Kevin Jicha
    Application System Administrator
    Navitus Health Solutions
    Appleton WI
    ------------------------------



If you've found this thread useful, dive deeper into User Group community content by role