+ Start a Discussion

Updated a rich text with an image

I have the following line of code in a trigger. It updates but I have a red x where the image should be.  I have verified that the image displays and exists.

Any help would be appreciated.


 c.Conservation_Duplicate__c = '<img src="https://c.cs16.content.force.com/servlet/servlet.FileDownload?file=015f00000000tji></img>';



Kamatchi Devi SargunanathanKamatchi Devi Sargunanathan



If you have a image in the documents tab, then go to that image and right click on the image and copy the image url. Then give it in the field value.


Try the following trigger,

trigger insertImage on Sample__c (before insert) {
     for(Sample__c s : Trigger.New){
         s.img__c = '<img src="https://c.ap1.content.force.com/servlet/rtaImage?refid=0EM90000000TsBK"/>';



Hope so this helps you...!

Please mark this answer a Solution and please give kudos by clicking on the star icon, if you found this answer as helpful.