JS to quickly check Salesforce field-level visibility checkboxes

Posted on Jul 07, 2015

This is a small, handy little javascript that will check all the checkboxes on the Field Visibility screen for a user profile.  Should work in the javascript console of all modern browsers.

var x = document.querySelectorAll(".displayedCol input"); for (var i = 0; i < x.length; i++) { x[i].checked="checked"; }

Sometimes while setting up objects and profiles for a project, you might do things out of order, or create objects using the Schema Builder or the Meta API, neither of which lets you set field permissions for user profiles.  Then you find yourself needing to go to each user profile, go to the field-level visibility settings of each object you created, and check all those boxes so the fields will be visible to the new profile.  The above javascript will check all the boxes for you; it's basically a "select all" for the Visibility column.