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
hema k 29hema k 29 

How Can I store Rich Text Area field(Image) of a custom object into document object

I have a trigger to insert document record whenever Contact record is created and I have one custom field Image__c which is Ritch Text Area data type, I am storing images in Image__C field, How can get this image__c into the document?
Murali MattaMurali Matta
Hi Hema,

Hope these links can help you.

https://developer.salesforce.com/forums/?id=906F00000009E0qIAE

https://success.salesforce.com/answers?id=90630000000grykAAA


Let me know if you have any confusion.

Kindly mark this as solved if the reply was helpful.

Thanks,
Murali
Bhargavi TunuguntlaBhargavi Tunuguntla
Hi hema

Please try refering the below link:

https://salesforce.stackexchange.com/questions/91692/get-images-from-rich-text-area-via-apex

This will extract the image from RichTextArea and you can save it to documents.
Let us know if it was helpful.

Thanks.
hema k 29hema k 29
I wrote the Apex code and call the apex method into trigger while inserting a record in the contact object its showing error, execution of AfterInsert caused by System.VisualforceException: Getting content from within triggers is currently not supported.: Class.DocumentRecord.beforeinsert: line 22, column 1 please help me, This my code : PageReference pageRef = new PageReference(container); string strFolderId = '0057F000002mY3w'; Document doc = new Document(); doc.Name = 'pic12'; doc.Type = 'png'; doc.Body = pageRef.getContent();