Knowledge found and lost while working with Microsoft Dynamics CRM
RSS icon Home icon
  • Disabling all fields within a Section

    Posted on February 2nd, 2010 mitch Print Print 2 comments

    Last week I encountered a need to disable all of the fields within a Section on a CRM Form.  While you can set the properties individually, that is a waste of effort and a maintenance nightmare.

    After a bit of digging, I found the following post on one of the CRM newsgroups by Kyaw Kyaw Tun, from http://www.pulsesync.com:

    var section = crmForm.all.new_attribute_c.parentElement.parentElement.parentElement;
    
    for (i = 0; i < section.all.length; i++)
    {
        section.all[i].Disabled = true;
    } 

    You replace new_attribute with the name of an attribute that resides inside the section you wish to disable.

    Note: That _c is not a mistake, that needs to be part of the attribute name.  For instance, to hide the section containing accountnumber, you would use accountnumber_c.

    Though the magic of the JavaScript Document Object Model ( DOM ), we’ll get a list of all of the fields and set their Disabled property to true.

    Customization, Dynamics CRM
    1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)
    Loading ... Loading ...
    446 views