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
ccPeterccPeter 

Add uploaded document to Related Content via API

Is there any way that a document uploaded to a Content Library (using the REST API) can be associated with the Related Content list of an Account, Contact, or Opportunity record using a REST or SOAP API?

 

Thanks

Peter

James_SFDCJames_SFDC

Hi Peter,

 

If chatter is enabled you make this association by posting on the record. 

1) Create a FeedItem

2) Type='ContentPost'

3) ParentId=<YOUR RECORD ID>

4) RelatedRecordId='<YOUR CONTENT VERSION ID>'

 

 

Eventually you'll be able to make this association directly through ContentDocumentLink without the need to feed post.

 

Thanks,

 

James

ccPeterccPeter

Hi James, that worked; thank you so much! The document in Salesforce Content, however, showed up in the Opportunity record’s “Google Docs, Notes, & Attachments” as opposed to “Related Content”.

 

Although I am actually totally happy with this (the key thing is that there is a link in the Opportunity record to the document) I
would like to ask (so I fully understand this) whether there is a possibility in the API to give the user a choice to what list the document link is added.

 

Peter