locked
crm 2011 there was an error with this field's customized event. Field:window Event:onload Error: Object doesn't support property or method 'disableAllControlsIn Tab' RRS feed

  • Question

  • Hi,

    I got the following error while trying to add attach file to a contact please help to resolve this issue crm 2011 there was an error with this field's customized event. Field:window Event:onload Error: Object doesn't support property or method 'disableAllControlsIn Tab'

    Thanks

    Tuesday, January 19, 2016 4:28 PM

Answers

  • Hello,

    Try to replace line 

    XrmServiceToolkit.Common.disableAllControlsInTab(tabIndex);


    with line 

    XrmServiceToolkit.Common.DisableAllControlsInTab(tabIndex);


    Dynamics CRM MVP
    My blog

    • Marked as answer by Hemanth555 Friday, January 22, 2016 2:52 PM
    Wednesday, January 20, 2016 3:55 PM
    Moderator

All replies

  • Hello,

    Please provide code of the method that handle form onload event.


    Dynamics CRM MVP
    My blog

    Tuesday, January 19, 2016 9:53 PM
    Moderator
  • Thanks for the response, Here is the code

    function IFRAME_MemberSchool_onload() {

    }
    function IFRAME_MS_onload() {

    }
    function IFRAME_Activities_onload() {

    }
    function IFRAME_HistoryFrame_onload() {

    }
    function Form_onload() {
        //Contact onLoad

        function disableTab(tabIndex) {

            XrmServiceToolkit.Common.disableAllControlsInTab(tabIndex);
        }

        //debugger;
        var CRM_FORM_TYPE_CREATE = 1;
        var CRM_FORM_TYPE_UPDATE = 2;
        var CRM_FORM_TYPE_READONLY = 3;
        var sHoldReason = Xrm.Page.data.entity.attributes.get("reg_holdreason").getValue();
        var bActive = Xrm.Page.getAttribute("reg_active").getValue();

        if (Xrm.Page.ui.getFormType() == CRM_FORM_TYPE_CREATE) {
            var queryOptions = {
                entityName: "reg_systemparameter",
                attributes: ["reg_tablename", "reg_fieldname"],
                values: ["contact", "reg_etfoid"],
                columnSet: ["reg_nextnumber", "reg_systemparameterid"],
                orderby: ["reg_nextnumber"]
            };

            var fetchedParameter = XrmServiceToolkit.Soap.QueryByAttribute(queryOptions);
            if (fetchedParameter.length > 0) {
                var Next = fetchedParameter[0].attributes["reg_nextnumber"].value;
                var SysParamId = fetchedParameter[0].attributes["reg_systemparameterid"].value;
                var sNext = String(Next);
                sNext = sNext.replace(",", "");
                Xrm.Page.getAttribute("reg_etfoid").setValue(sNext);
                //update systemparameter
                Next++;

                //Use XrmServiceToolkit.Update() to update a CRM reg_systemparamter record. 
                var reg_systemparam = new XrmServiceToolkit.Soap.BusinessEntity("reg_systemparameter", SysParamId);
                reg_systemparam.attributes["reg_nextnumber"] = Next;
                var updateResponse = XrmServiceToolkit.Soap.Update(reg_systemparam);

            }
        }
        if (Xrm.Page.ui.getFormType() == CRM_FORM_TYPE_UPDATE) {

            var sHR = Xrm.Page.data.entity.attributes.get("reg_holdreason").getText();
            if (sHR != null) {
                if (sHR == "Discipline") {
                    alert("This member currently has a hold for Discipline.  Please review the Discipline items on the left side bar.");
                }
            }
            if (bActive != true) {
                alert("This member is NOT currently active.");
            }

            if (XrmServiceToolkit.Soap.IsCurrentUserRole("PRS")) {
                disableTab(0);
                disableTab(1);
                disableTab(2);
            }
            if (XrmServiceToolkit.Soap.IsCurrentUserRole("Committees")) {
                disableTab(0);
                disableTab(1);
                disableTab(2);
            }

        }
        if (Xrm.Page.ui.getFormType() == CRM_FORM_TYPE_READONLY) {

            var sHR = Xrm.Page.data.entity.attributes.get("reg_holdreason").getText();
            if (sHR != null) {
                if (sHR == "Discipline") {
                    alert("This member currently has a hold for Discipline.  Please review the Discipline items on the left side bar.");
                }
            }
            if (bActive != true) {
                alert("This member is NOT currently active.");
            }
        }

        XrmServiceToolkit.Common.DisableField("reg_membershiptype");
        XrmServiceToolkit.Common.DisableField("address1_line1");
        XrmServiceToolkit.Common.DisableField("address1_line2");
        XrmServiceToolkit.Common.DisableField("address1_line3");
        XrmServiceToolkit.Common.DisableField("address1_city");
        XrmServiceToolkit.Common.DisableField("address1_country");
        XrmServiceToolkit.Common.DisableField("address1_postalcode");
        XrmServiceToolkit.Common.DisableField("address1_stateorprovince");
        XrmServiceToolkit.Common.DisableField("address1_name");
    }
    function Form_onsave() {

    }
    function reg_active_onchange() {
        if (Xrm.Page.getAttribute("reg_active").getValue() == false) {
            Xrm.Page.getAttribute("donotpostalmail").setValue(true);

        }
    }
    function reg_holdmailings_onchange() {
        if (Xrm.Page.getAttribute("reg_holdmailings").getValue() == true) {
            Xrm.Page.getAttribute("donotpostalmail").setValue(true);

        }
        if (Xrm.Page.getAttribute("reg_holdmailings").getValue() == false) {
            Xrm.Page.getAttribute("donotpostalmail").setValue(false);

        }
    }
    function firstname_onchange() {

    }
    function telephone2_onchange() {
        // Get the field that fired the event
        var oField = Xrm.Page.getAttribute("telephone2").getValue();

        // If we have the field and all is well
        if (typeof (oField) != "undefined" && oField != null) {
            oField = FormatPhone(oField);
            Xrm.Page.getAttribute("telephone2").setValue(oField);
        }
    }
    function mobilephone_onchange() {
        // Get the field that fired the event
        var oField = Xrm.Page.getAttribute("mobilephone").getValue();

        // If we have the field and all is well
        if (typeof (oField) != "undefined" && oField != null) {
            oField = FormatPhone(oField);
            Xrm.Page.getAttribute("mobilephone").setValue(oField);
        }
    }
    function fax_onchange() {
        // Get the field that fired the event
        var oField = Xrm.Page.getAttribute("fax").getValue();

        // If we have the field and all is well
        if (typeof (oField) != "undefined" && oField != null) {
            oField = FormatPhone(oField);
            Xrm.Page.getAttribute("fax").setValue(oField);
        }
    }
    function preferredcontactmethodcode_onchange() {

    }
    function donotpostalmail_onchange() {

    }

    Wednesday, January 20, 2016 3:33 PM
  • Hello,

    Try to replace line 

    XrmServiceToolkit.Common.disableAllControlsInTab(tabIndex);


    with line 

    XrmServiceToolkit.Common.DisableAllControlsInTab(tabIndex);


    Dynamics CRM MVP
    My blog

    • Marked as answer by Hemanth555 Friday, January 22, 2016 2:52 PM
    Wednesday, January 20, 2016 3:55 PM
    Moderator
  • Thank you so much bro, It works like a charm.

    Have a great day.

    Friday, January 22, 2016 2:51 PM