Showing posts with label security. Show all posts
Showing posts with label security. Show all posts

Monday, February 27, 2012

Select All Visible or Read-Only Checkboxes in Field-Level Security

It looks like I'm not the only one who has historically wanted a way to mark all Visible or Read-Only checkboxes on the Field-Level Security page in Salesforce.

Fortunately, while Salesforce (hopefully) works to make this a standard feature, administrators can use the following bookmarklets on this Salesforce Hacks page:
  • Mark all fields as visible
  • Mark all fields as read-only

Try it out with a profile in your org!

Tuesday, May 24, 2011

JavaScript Hack to Set Visibility for Field-Level Security

Having to click numerous (sometimes over 100) checkboxes just to grant or revoke visibility to certain fields via Field-Level Security settings can be a pain. Here's a JavaScript hack that can mark all of the "Visible" checkboxes on the Field-Level Security edit page.

The following code was tested in Firefox 4 and Chrome 11 on Windows 7. It can probably be adapted easily to work for marking the read-only checkbox and for clearing checkboxes as well.

javascript:

/* Locate the form. */

var flsForm =
    document.getElementById("editPage");

/* Find the form inputs. */

var inputs =
    document.getElementsByTagName("input");

var visibleInputs = new Array();
for(var i = 0; i < inputs.length; i++) {
  var titleAttr = inputs[i].attributes["title"];
  if(titleAttr != null) {
    if(titleAttr.value == "Visible") {
      var visibleInput = inputs[i];
      visibleInputs[visibleInputs.length] =
          visibleInput;
    }
  }
}

/* Mark all checkboxes. */

for(var i = 0; i < visibleInputs.length; i++) {
  var eName =
      visibleInputs[i].attributes["name"].value;
  
  var e = flsForm.elements[eName];
  
  if(!e.checked)
    e.click();
}