Problem with disabling a form RRS feed

  • Question

  • Hi,

    I want to programmatically disable a form (in a supported manner), if a certain condition exists.  What I have works, except that it doesn't  disable the plus icon buttons for adding a new item from an N:N relationship.  How do i do that?  Thanks.

    var allAttributes = Xrm.Page.data.entity.attributes.get();

     for (var i in allAttributes) {

            //Get the name of the attribute
            var attributeName = allAttributes[i].getName();

            //Get the control for the attribute
            var attributeControl = Xrm.Page.getControl(attributeName);

            //statecode variable does not have getName or getDisabled functions, so skip over it. 
            if (attributeName != 'statecode') {

                if (attributeControl != null) {

    Thursday, January 8, 2015 9:15 PM