I need to add an Attachment (image) to a custom record, and i would like this to happen on record creation. I was thinking of having a rich text field that is required on record creation, where a user would put an image in.

Is there a way to automatically transfer the image from the rich text field into the attachments section when the record is saved?

  • You'll have to write your own code for this- I assume from you having the [trigger] tag on this question, that you are okay with writing apex code- so I've added the [apex] tag as well. – battery.cord Jun 23 '17 at 18:50
  • @battery.cord Do you know of any example Apex code for retrieving an image from a Rich Text Area and making it an Attachment? Or how to make a VF Page (Upload image button) required on record creation without rewriting the entire layout in VF? – Graydon Jun 23 '17 at 19:02
  • Is there a reason that you would add it to rich text before you added it as an attachment? – Logan Jun 23 '17 at 19:03
  • @Logan I just figured i can make a rich text field required on record creation but I have no experience with adding an attachment on creation, only after it has been created. – Graydon Jun 23 '17 at 19:04

This is the information provided from Salesforce on adding an attachment. Salesforce Developer

  • Thank you, however I'm not trying to add an attachment to an email template, im trying to add it to the record itself (In the notes and attachments section).. – Graydon Jun 23 '17 at 19:09
  • I would use the SF information/examples on how to add an attachment with a jQuery solution like this: demo – Logan Jun 23 '17 at 19:09
  • I did not vote down, but link only answers are often poorly received here. If the link answers the question, please cite the relevant content here. Links tend to break over time, so a good question or answer will still make sense even if all the links were to go dead. – Adrian Larson Jun 25 '17 at 1:06

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.