2

Summary:

Org 1 wants to be able to access data that lives in Org 2. For most use cases, we have this figured out using the Salesforce Connect Cross-Org Adapter.

However, there is a specific need for the org to access Notes. The org is using “Enhanced Notes” which uses the ContentNote object. The Notes are related to other records like Accounts, Contacts, etc. via ContentDocumentLink junction object.

What I have found so far is that with ContentNote and ContentVersion, you can only export/query the records that are explicitly shared with you or that you own.

The Issue:

The issue I am facing on this is when using the Salesforce Connect adapter to expose the ContentNote object, there is no data being passed over. I believe the reason for this is because the API user is not associated with the entity/record that the note is attached to?

My Test:

I ran the query on the shared object using the following:

SELECT ... FROM ContentNote__x

I am only getting rows back where the API user was the one who created the note. I am unable to see any notes that were created by another user.

When creating the notes, there is the text “Visibility Set by Record” (example image attached) which leads me to believe that this note is only viewable by those associated with the Contact/Account/Lead etc. in some way that the note is being created for. This poses a problem for me.

enter image description here

The Question:

Is there a work-around / hack where I would be able to somehow allow this API user, whether it be through a permission set, role etc, be able to access all notes? If not access to the notes directly, what about associating the user in some way to the originating record so that the API user somehow relates to the Contact or Lead that this note was created on?

References to my Research:

https://douglascayers.com/2017/06/26/how-to-export-notes-from-salesforce/

https://help.salesforce.com/articleView?id=notes_considerations.htm&type=5

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contentdocumentlink.htm

3
  • Do you have the ability to put some type of trigger in org2 so that for every note created, the note is explicitly shared with the api user? Commented Oct 3, 2019 at 15:48
  • @KrisGoncalves - I am having a hard time even finding where I would allow this API user to see it manually, to be honest. It looks like the view access is inherited by people who already have access to the entity this note was created on (Contact, Lead, etc). Are you saying that if a user creates a note on a Lead, I need to associate the API user to the lead, if it was created on a contact, the API user needs to be associated with the contact etc so that they get access inherently? I don't see a way to specifically adjust a notes view access.
    – SBB
    Commented Oct 3, 2019 at 15:54
  • I was spit balling, but that was the first thing that came to mind to essentially always create a contentdocumentlink to the API user so they have access. I haven't done this myself or tested it. It might be useful to just query the ContentDocumentLink of one example in workbench to see what the ShareType and Visibility settings are. Commented Oct 3, 2019 at 16:13

1 Answer 1

2

In Spring 19 there is an option to query all the files ( Notes and Attachments) . Please follow the below steps to enable the permission to the user.

Create a permission set.

In Permissions set, go to App Permission->Content. Under Content you can see an option called Query All Files. Check the field and save the permission set.

After that, you can add the permission set to the related user.

I tried the below query for my testing purpose and I am able to query all the records from the salesforce.

Select Id, LinkedEntityId, LinkedEntity.name, ContentDocumentId ,ContentDocument.LatestPublishedVersion.TextPreview, ContentDocument.title,ContentDocument.fileextension from ContentDocumentLink WHERE LinkedEntityId in (SELECT Id FROM Contact) and ContentDocument.LatestPublishedVersion.TextPreview != ''

2
  • I will try this first thing tomorrow when I get into the office and report back. From your explanation, it sounds promising! As long as these are all files and documents created by anyone, and not just associated with the user that this permission set is applied to then it will be perfect.
    – SBB
    Commented Oct 13, 2019 at 20:09
  • The above Query is already there in the first link shared by the OP mentioned as There is a workaround and that is to query on ContentDocumentLink record. And it seems that it is independent of the permission set.
    – Saroj Bera
    Commented Oct 14, 2019 at 12:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .