0

I'm working with a very big org, and I would like to update one profile's object settings so they can read all objects in the org, and read all fields in the org without doing it manually. Is this possible to do with Apex or with Dataloader?

3 Answers 3

0

Is this possible to do with Apex or with Dataloader?

No, and no.

What you can do is install the Force.com IDE, download the profile, then do a Find-Replace in their profile for all of the objects. This is arguably the fastest way to do so without too much effort.

To do this, after installing the Force.com IDE, create a new project. When asked to select the metadata you want, select the profile in question and all of the objects you wish to update. This will give you a profile XML file and a bunch of Object XML files. You can ignore those, since you simply need to update the Profile.

Inside the file, you'll find a whole mess of "objectPermissions" entries, one for each object. Simply highlight all of them, then choose Search > Find. In the search field, type in <allowRead>false</allowRead>, and in the Replace field, type in <allowRead>true</allowRead> (note: some versions of the API may have had different labels, so check one of the entries first).

After you replace all of the values in the selected range, then save the file. It should automatically deploy back to the server with the new changes. If not, right-click on the file in the Project Explorer, then choose Force.com > Save to server.

If you don't want to install any software, you could do this with the Workbench, but it would require you to build your own package.xml or a package. A package would probably be easier. Simply go in to your org, go to Setup > Create > Packages, add all of the Custom Objects to your package, as well as the desired profile, then do a Metadata > Retrieve based on the package name.

As a package.xml file, you'd want something like this:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>CustomField</name>
    </types>
    <types>
        <members>*</members>
        <name>Profile</name>
    </types>
    <version>40.0</version>
</Package>

You can upload this to the workbench, which will give you a ZIP file with the files you requested. From there, update the files, as above, and then you can use the workbench to deploy the changes.

0

I figured out one strategy to do this through Workbench.

  1. Do a SOQL Query on the ObjectPermissions object and set your WHERE clause to the Parent.Profile.Name to Profile that you are looking for, and download it as a CSV file.

SELECT Id, ParentId, PermissionsRead, sObjectType FROM ObjectPermissions WHERE Parent.Profile.Name='Whatever your profile name is'

  1. Edit this in an Excel spreadsheet by changing the first line to what you want, highlighting this first line, and then double-clicking the bottom right hand corner.

  2. Upload this file through data update in workbench.

This can be repeated for the FieldPermissions object as well.

0

There are third party applications that allow you to modify multiple profiles or permission sets at a time. I've tried all the applications I can find and prefer Security Zen. Yes, I am associated Security Zen, but we created the application because we were not satisfied with the alternatives.

Mike

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.