I am getting a URL for an image from an API call that I am assigning to a Rich text area field in Salesforce. The field is being populated with the text of the URL rather than the actaul image.

Is there a way in my Apex Class to define the input type into the field as an image URL so that the field populates with the image rather that the text?


Rich Text fields are stored as HTML in Salesforce, so to show your image, you will have to wrap the image URL with <img tage before storing in the Rich Text field.


Rich_Text__c='<img src="http://www.w3schools.com/tags/smiley.gif" alt="Smiley face" width="42" height="42">';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.