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
Prajapati.LakhanPrajapati.Lakhan 

Salesforce CRM content

Hi Everyone.

 

Do you have idea about how to associate a salesforce content doc with a custom object record using Apex? I have done ths using standared functionlity with follwing steps -

 

1. Add "Related Content" related list to the pagelayout of selected custom object

2. Click on the  "Search All" button. It will redirec to the Conent tab (With list of all shared content docs/images/videos)

3. Select particular content doc and click on the "Attach" link besides the selected content.

 

Content will be associated with the selected record and will be displayed in "Related Content" related list.

But i dont understand how this association is handled in backend (database point of view). I did not find any relational fields in ContentDocument or ContentVersion object using them we can establish this relationship.

 

How to create this mapping between object record and sfdc conten?

What is  the use of parameters "eid" and "rel" passed after clicking on Find Content button of "Related Content" related list?

 

Any help will be apriciated!!

 

Thanks in advance

Lakhan

bob_buzzardbob_buzzard

I've added a custom account lookup to my content object, and the database object that this gets added to is ContentVersion.  ContentVersion also has a FirstPublishContentId which is a polymorphic lookup to most object types.  What makes me less than convinced this is how it works is that I can't see how an item of content could be attached to multiple objects (assuming that's allowed through the UI).

Prajapati.LakhanPrajapati.Lakhan

Hi Bob,

 

Thanks for your reply,  I have created a custom lookup field in content object but i didn't see any field "FirstPublishContentId"  instead there is a field "FirstPublishLocationId" which can only contain user id or workspace id according to documentation (however it is polymorphic field),please let me know if I missed something . I am only concerned about how can we simulte attach particular content to specific record using APEX ( "Related Content" related list behaviour using APEX).

 

Thanks,

Lakhan

swati-srivastavaswati-srivastava

hello,

 

were u able to achieve this.

 

i also want to do the same but no idea how to do this.

 

kindly guide me m a complete newbie.

:)