Checking / Unchecking all field visibility for a profile

sometimes you wind up having 100 fields to check uncheck on an object to give or take visibility to a user profile.  Here's a handy javascript hack that lets your browser do all the checkbox checking for you.

Select the profile

Select the profile

Find the object you want to change

Find the object you want to change

On that object Click Edit

On that object Click Edit

You now see all the checkboxes

You now see all the checkboxes

Now Rather than checking all the checkboxes..

Open Chrome's Developer Console by Pressing F12

Open Chrome's Developer Console by Pressing F12

Open the Javascript console if it's not already there.

Open the Javascript console if it's not already there.

And then Paste the Following 2 lines to uncheck all the checkboxes

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

for (var i = 0; i < inputs.length; i++){ if ((inputs[i].id.indexOf('display_') > -1)&&(inputs[i].checked))  inputs[i].click();}

Then press Enter

 

[to CHECK the checkboxes use these 2 lines instead]

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

for (var i = 0; i < inputs.length; i++){ if ((inputs[i].id.indexOf('display_') > -1)&&(!inputs[i].checked))  inputs[i].click();}

{Bonus:  after you do it once, you can just hit the up arrow after clicking in the console are to recall the last command}

F12 to close Developer Tools and Save.

F12 to close Developer Tools and Save.

There you go,  you just unchecked 100 fields in about 10 seconds.