Salesforce: How to Use Workbench to Mass Update Folder Permissions for Reports and Dashboards

Our users had wanted to update permissions for hundreds of report and dashboard folders in Salesforce. Rather than manually modifying the folder permissions through the Salesforce UI, we can mass update these permissions using the Metadata API through Workbench, an unofficial Salesforce tool.

My deepest gratitude to Roger Mitchell, our brilliant mentor and developer, for the guidance.

These instructions are specific to MacOS X.

 Pre-requisites:

 Preparing your package.xml:

  • Use Workbench (Queries > SOQL Query) to export a CSV of folders whose permissions you’d like to update.
    • SELECT DeveloperName, Type, AccessType, Id, ParentId FROM Folder
    • Prepare the spreadsheet:
      • Remove all rows where ParentId != NULL. This is because subfolders get their permissions from their parent folders.
      • Separate the rows based on the permissions you’d like to update to. For instance, perhaps one tab contains rows of folders whose permission you’d like to update to “All Internal Users”.
  • Create a package.xml based on the attached template here. This package.xml should contain folders whose permissions you’d like to update.
    • In the package.xml, create additional rows with the <members> tag that contain the DeveloperName of the folder.
    • You may create additional <types> as you see fit, such as Insights (for Einstein Analytics folders), Email, and Document.
    • Save the package.xml.

 Modifying your retrieved XML files

  • In Workbench, navigate to Migration > Retrieve.
    • Choose the package.xml you’ve modified earlier, and click Next. You may ignore Package Names and Single Package.
    • Click Retrieve.
    • Download the .zip file.
  • Unzip the .zip file. You should have a folder called “unpackaged“.
  • Drag the entire folder to your favorite IDE: VS Code, Sublime Text, etc.
  • VS Code: XML for Folder Permissions
    • You’ll see a list of folders and their corresponding XML files, containing the current state of permissions for the folders.
    • Modify each .xml file with permissions that you desire. For example, you may assign View, EditAllContents, or Manage to All Internal Users:
      • <folderShares>
        <accessLevel>View</accessLevel>
        <sharedTo>AllInternalUsers</sharedTo>
        <sharedToType>Organization</sharedToType>
        </folderShares>
    • Save all .xml files with the updated permission changes.
  • Zip up the unpackaged folder containing the updated XML files.
  • Open Terminal, and run this command to delete the hidden __MACOSX file from the .zip file (or else you’ll run into an error when deploying):
    • zip -d unpackaged.zip "__MACOSX*"

 Deploying folder permission updates

  • In Workbench, navigate to Migration > Deploy.
    • Upload the unpackaged.zip file.
    • If you’re deploying to Production, check “Rollback on Error” and select RunLocalTests for Test Level.
    • Click Next, and wait for the deployment to be completed.
  • Double check through the UI that the permissions for your folders have been updated.

In Conclusion

As a Salesforce admin, there’s no easy way to mass update folder permissions currently through Salesforce’s UI. The simplest way to do this is to utilize the Metadata API is through Workbench. Be sure to test this through a sandbox before deploying permission updates in Production.

(Visited 1,896 times, 1 visits today)

1 Comment Salesforce: How to Use Workbench to Mass Update Folder Permissions for Reports and Dashboards

  1. Yana

    Hello, after I update rezipped to deploy, I am getting these errors

    “An object ‘CA_English_Provider_Website_Help’ of type EmailTemplate was named in package.xml, but was not found in zipped directory”

    It doesn’t seem to update the xml folder files. Do you know how to work around this problem

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *