Is there a quick and dirty way to assign read only to every field in all objects at once? It is rather tedious for read only profiles to go object by object/field by field.


1 Answer 1


Other than using code to generate permission set data (which is possible - iterate the schema and generate the required XML as a string which you debug log out; run the code, copy and paste the XML into a permission set meta XML file and deploy), I don't know of a way to do this for profiles for more than one object at a time.

If one object at a time is acceptable the following JavaScript can be copied, pasted and executed in the browser console to do this in the context of a Profile's Object Settings > Some Object page in edit mode (you must navigate to the required object's permission page then hit edit before using).

This clears editability and ensures readability for the various Field Permissions (you could extend this to also handle the Object Permissions as you want):

Array.prototype.forEach.call(document.getElementsByTagName("input"), element => { let id = element.id; if (id.endsWith("fls_edit_ck")) { element.checked = false; } else if (id.endsWith("fls_read_ck")) { element.checked = true; } });

You need to save the changes after executing. Once executed once in your browser you should be able to retrieve the command via command history to make it quicker to use on subsequent objects.

This works in Lightning Experience (tested) and probably in classic too (I haven't tested).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .