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
KruviKruvi 

Relating Content to A Custom object in APEX

Hi

 

My stuck with this feature:

 

I need to Relate (Connect) a ContentVersion object (A file I retrive from an email) I create in my Apex code to a custom object I have in the database.

 

The GUI feature that allows to do that has a Related To lookup filed but I can't find how to do this in APEX.

 

I appricate an advise

 

Thanks

 

 

hitzhitz

Hi,

Not Clear with your requirement.

can you please explain in detail

KruviKruvi

Let me try and explain:

 

I have an APEX class which processes an incoming email message.

The code should take the attachment to the email, create a ContentVersion object and relate this Content to another custom object I have lets say AAA

I was able to achieve everything but relating the Content to AAA.

 

This functionality is available when adding a Content from the Detail Page GUI of AAA.

 

How do I do this in my APEX code.

 

Thanks

jonathanrico.jonathanrico.

Hi Kruvi,

 

Where you able to find a workaround for this? I'm facing the same issue. Here's a link to my case:

 

http://boards.developerforce.com/t5/Apex-Code-Development/How-to-associate-a-file-to-chatter-stream-from-Apex/td-p/390525