Signature

global static List<List<Attachment>> getSharedResources(
  List<String> parentIds,
  String runAs
)
Parameters
ParameterDescription
parentIds
List<String>
requiredThe Salesforce record Ids to list shared resources for.
runAs
String
optionalEmail Id of the user on whose behalf the function should run. To run the action as the automation user, supply integrationUser.

Return Type

List<List<Attachment>>. One list per record Id, in the same order as parentIds. Each list holds the resources on that record that are shared with community users.

Example

List<String> parentIds = new List<String>{ '001dL00000a1B2cQAE' };

List<List<cldfs.Attachment>> shared = cldfs.Client.getSharedResources(parentIds, 'integrationUser');
for (cldfs.Attachment attachment : shared[0]) {
  System.debug(attachment);
}
Shared resources and attachmentsThis method lists only the resources on each record that are shared with community users, for example through Share with Community User. To list every resource attached to a record, shared or not, use Get Attachments.
TestingUse ClientFactory with default mock values to get coverage without callouts. See How to get test coverage of code that uses Client methods.