Salesforce Cookies #11 ( Salesforce Admin Special )

Is there a way to mass-check Checkboxes when updating a Profile’s Object’s Field-Level Security?

Of course, there is. You can do it through your browser’s console. You just need the following Javascript code snippet which will do the job for you.

For the Edit Permission
var checkboxes = document.querySelectorAll(".displayedCol input");
for (var i = 0; i < checkboxes.length; i++) {
   checkboxes[i].checked=true;
   handleEditClick(checkboxes[i]);
}
For the Read Permission Only
var checkboxes = document.querySelectorAll(".readonlyCol input");
for (var i = 0; i < checkboxes.length; i++) {
   checkboxes[i].checked=true;
   handleEditClick(checkboxes[i]);
}

Running JS code snippet in the Google Chrome for updating the field-level permissions

  1. First, navigate to the Field-Level security page for profile and click on Edit button so you can perform the check and uncheck
  2. Now from the Chrome menu > More Tools > Select ‘Developer Tools’ and Click on the Console tab / Press Ctrl+Shift+J.
  3. Copy and Past the above JS code in the console editor and hit the return key.
  4. Save the changes

20180328-122619_capture

Salesforce Cookies #10

Creating a dynamic SOQL which includes all the fields

I have seen this question several times on developer forums and I thought it could be another addition to Salesforce cookies. If you are wondering how can you query all the fields of an object then you can use the following code snippet.

The above code snippet using describe calls to get all the fields and then created a dynamic SOQL query to get all the field values.

This is quite similar to SQL query which uses wildcard characters – SELECT * FROM Table.