1

I have a use case where in production i have to give 10 objects each field permissions to 5 profiles. Is there any shortcut of that instead of going each field one by one and update checkbox.

Any soql or anything we can run?

  • 5
    Probably not what you are looking for, but for objects with large numbers of fields this sort of browser extension is a big help when doing the work manually - Salesforce Admin Check All. – Keith C Feb 8 '17 at 21:59
  • 1
    Also, in a few releases, we might get this idea, which means we could write exec anon script to do the same thing. – sfdcfox Feb 8 '17 at 22:30
  • 1
    @DavidMycka In general, if you appreciate an answer and find it helpful, it is more appropriate to vote for it instead of leaving a comment. If one in particular addressed your problem, please also consider accepting it. Thanks! – Adrian Larson Feb 9 '17 at 3:29
2

I wrote a quick bookmarklet years ago that I use for this purpose. While you still have to go to each setup page, this would reduce the number of clicks to just one per page. It's even nice enough to click "Save" for you.

javascript:var a,b,c,d,e,f;a=document;b=function(v){return a.querySelectorAll(v)};c=function(v){return a.querySelector(v)};d=function(j,k){[].forEach.call(j,k)};e=b('input[type=checkbox]');f=c('select option[value="2"]');if(e)d(e,function(v){v.checked=1});if(f)f.selected=1;c('input[value="Save"]').click();"

In most browsers, you can just go into the Bookmark Manager feature, create a new bookmark with this code, and save. This script is meant to be used on the Edit Object page of the Enhanced User Profile Interface (you can enable this in Setup > Customize > User Interface).

1

Assuming you have API access, you can install the Force.com IDE and update all of the values at once.

Step 1: Install the Force.com IDE

Install the IDE.

Step 2: Prepare One Profile

Set all the field permissions you want in one of the profiles.

Step 3: Create a New Force.com Project

Create a new project, and select all of the profiles you want to update, and all of the objects you want to get permissions for.

Step 4: Copy and Paste Settings

Go to the template profile we prepared in step 2, copy all of the fieldPermissions entries to your clipboard, and then open each other profile and replace its fieldPermissions entries with the fieldPermissions of the template. When you save the changes, they should all be updated.

Step 5: Validate Results

Whenever you're mass updating security, make sure you spot check your profiles to make sure all the field permissions are set correctly.


N.B. Doing this in production will cause a RAT (Run All Tests). Deployment will take as long as it takes to run all your tests, so I suggest saving all the files at the same time. Alternatively, do this in your sandbox, and then change-set the profiles and objects into production.

1

I had the same question and didn't want to deal with slow server roundtrips updating the object metadata through the IDE, nor deal with someone else's browser plugin. It was pretty easy to investigate the page source and whip something together.

I run a some of these scripts semi-frequently for this sort of change. Just open up the javascript console when you're on the object configuration in your browser of choice and run any of the below scripts.

Object Level Permissions

document.querySelectorAll('[id$="olp_value"] input').forEach(function (checkbox) {
    checkbox.checked = true;
});

Record Type Assignments

document.querySelectorAll('input[id$="rt_assign"]').forEach(function (checkbox) {
    checkbox.checked = true;
});

Field - Read Access

document.querySelectorAll('[id$="fls_read"] input’).forEach(function (checkbox) {
    checkbox.checked = true;
});

Field - Edit Access

document.querySelectorAll('[id$="fls_edit"] input').forEach(function (checkbox) {
    checkbox.checked = true;
});

Obvsiously, you can set any of these checkboes to false, and also one-line them. I just spaced them out a bit for readability.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.