You need to sign in to do that
Don't have an account?
Joshua Long 17
Partner Community access to ContentDocumentLink
I have a lightning Component that queries ContentDocumentLink based on an Article Id to then query ContentDocument to display the linked Files.
This works perfectly for Internal users yet when exposed to Partner Community Users the first query returns no results yet it is pulling the same Article Id to filter on.
Based on the help article here: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contentdocumentlink.htm
The community users have the level of access to pull results from the ContentDocumentLink object. Any additional ideas on how to achieve this goal?
I can query straight to the ContentDocument object and show the results to the Community but I am not able to filter to the relevant files.
This works perfectly for Internal users yet when exposed to Partner Community Users the first query returns no results yet it is pulling the same Article Id to filter on.
Based on the help article here: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contentdocumentlink.htm
The community users have the level of access to pull results from the ContentDocumentLink object. Any additional ideas on how to achieve this goal?
I can query straight to the ContentDocument object and show the results to the Community but I am not able to filter to the relevant files.
@AuraEnabled public static List<ContentDocument> getDocs(Id articleId) { List<ContentDocument> docs = new List<ContentDocument>(); System.debug('article Id ' + articleId); List<ContentDocumentLink> relatedDocs = [SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId =: articleId]; System.debug('list size ' + relatedDocs.size()); List<Id> docIds = new List<Id>(); if(relatedDocs.size() > 0) { for(ContentDocumentLink relDoc : relatedDocs) { System.debug('doc Id ' + relDoc.ContentDocumentId); docIds.add(relDoc.ContentDocumentId); } docs = [SELECT ID, Title, FileType, ContentSize, ParentId, PublishStatus, SharingOption, FileExtension FROM ContentDocument WHERE Id =: docIds]; } else { docs = [SELECT ID, Title, FileType, ContentSize, ParentId, PublishStatus, SharingOption, FileExtension FROM ContentDocument ORDER BY ContentModifiedDate DESC]; } system.debug('all docs' + docs); return docs;
Joshua Long 17
Found one solution by using the below trigger logic