function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Devender TharejaDevender Thareja 

Mass update FolderShare for Reports or Dashboard folders

I understand that SOQL access to FolderShare object is not available and if you want to programmtically update/retrieve FolderShare information, the only work-around is:
1. Use metadata API - retrieve, for all Folder metadata for Dashboard or Report, I was focussing on Dashboards only.
2. This will retrieve all dashboard metadata and it would have information for FolderShare data. Use any editor to make changes, for example remove access to a group, add access to a group etc.
3. Use metadata API - deploy to send updated metadata to org or sandbox.

This is explained here: https://help.salesforce.com/articleView?id=000318221&type=1&mode=1 (https://help.salesforce.com/articleView?id=000318221&type=1&mode=1" style="color:blue; text-decoration:underline)

I used package.xml for step 1 as below:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>        <members>AGM_Marketing_Operation_Dashboard_Folder/AM_AD_Activity_Dashboard_PFQ</members>
        <name>Dashboard</name>
    </types>
    <version>48.0</version>
</Package>

I was able to successfully retreive AM_AD_Activity_Dashboard_PFQ.dashboard.

Now QUESTION:
I was expecting FolderShare tag to be part of this dashboard file. It was not there. Do I need to code FolderShare in the package.xml instead of Dashboard? How would I know id of FolderShare , as * is not supported. 

Please share if you have done this or know how to do it.

Thanks!
 
ANUTEJANUTEJ (Salesforce Developers) 
Hi Devender,

I found the below documentation for FolderShare package.xml file and I think you need to explicitly mention in the package.xml file.

Please find the link for package.xml file below:

>> https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_foldershare.htm

Hope this was helpful and please close the thread by marking a best answer so that it can be useful for others in the future and it also helps in keeping the community clean.

Regards,
Anutej
Devender TharejaDevender Thareja
Thanks for your comment Anutej. I had looked at this page but I couldn't figure how to specify the folder name in package.xml .
<?xml version="1.0" encoding="UTF-8"?>
<DashboardFolder xmlns="http://soap.sforce.com/2006/04/metadata">
<folderShares> <accessLevel>View</accessLevel> <sharedTo>R1</sharedTo> <sharedToType>Role</sharedToType> </folderShares>
</DashboardFolder>

This made me think that I can just request Dashboard and correpondong folder would be pulled down.

Do you have an example package.xml for requesting a pecific Dashboard folder?