• Joshua Long 17
  • NEWBIE
  • 5 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
I have code that creates FeedItem and FeedAttachment It works fine in Sandbox but in Production I am getting:
21:43:57.239 (2631676416)|FATAL_ERROR|Internal Salesforce.com Error

I do not see any other information regarding the error it hits.
The code snippet I have is:
List<Database.SaveResult> srInsertList = new List<Database.SaveResult> ();
        try {
            if (!allFeedAttachment.isEmpty()) {
                List<FeedAttachment> allFeedAttachmentList = new List<FeedAttachment> ();
                allFeedAttachmentList.addall(allFeedAttachment);
                system.debug('size of post attachments ' + allFeedAttachment.size());
                srInsertList.addall(Database.insert(allFeedAttachmentList, false));
            }
            for (Database.SaveResult res : srInsertList) {
                if (!res.isSuccess()) {
                    Database.Error error = res.getErrors().get(0);
                    String failedDML = error.getMessage();
                    String errMsg = failedDML + ' Fields: ' + error.getFields();
                    system.debug('error>>> ' + errMsg);
                    system.debug('error>>>2 ' + res.getErrors());
                }
            }
        }
        catch(Exception ex) {
            System.debug('feedAttachment insert error: ' + ex);
        }

Any help figuring this out would be greatly appreciated!
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.
 
@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;

 
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.
 
@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;

 
I have a lightning component that shows a contact's files and attachments. It works fine in my normal sandbox but when I drop it into a Communities page, it shows nothing. I see references to giving users the "View Content in Portal" permission to allow access in Portal ALL OVER THE PLACE, but I have some questions about that:

1. I cannot find the "View Content in Portal" permission anywhere. WHERE IS IT?
2. Are Communities and Portal the same thing or at least do they use the same permission settings?
3. If I find this elusive setting and turn it on, will it allow me to query the ContentDocumentLink, Document, and Attachment objects for a Community user?
4. If I want to allow them to upload their own documents, what are the licensing implications?


Thanks,
Vance