Sep 24, 2024
102 Views
Comments Off on Upload Files as Attachment using Apex Salesforce
0 0

Upload Files as Attachment using Apex Salesforce

Written by

Files replaced Attachments in Salesforce.  Now any type of document upload becomes part of Files/Content in Salesforce. With all the other advantages over Attachments, the best one is Files can be shared across objects, means having a attachment with multiple parents.

In lightning experience, any attachment upload is uploaded as files after Winter 16.  But in salesforce classic you need to go to files settings and check “Files uploaded to the Attachments related list on records are uploaded as Salesforce Files, not as attachments” to make this happen. From then onwards Attachments will be uploaded as Files from classic too.

We all being uploading attachment in different ways one and of the ways is via Apex. Now how to upload Files as Attachment using Apex ? It is very simple you just need to understand the object relations and thats it.

ContentDocument This object record you don’t create. It gets created when you create Content Version who is child of ContentDocument. But Id of this record will be required to do other stuff.

 

Article Categories:
Blog
Ramya Singh
https://thestarbiznews.com

Ramya Singh isn't your average tech blogger. Sure, she's got the brains to understand the latest algorithms and the jargon to explain them in plain English. But she's also got a twinkle in her eye and a way of weaving technology into the fabric of everyday life that makes it nothing short of fascinating. Whether she's reviewing the latest smartphone, exploring the potential of virtual reality, or delving into the ethical implications of artificial intelligence, Ramya does it with a contagious enthusiasm that makes you want to learn more, do more, and be a part of the exciting world of tech. So, if you're looking for a tech blog that's informative, inspiring, and just plain fun, follow Ramya Singh. She'll take you on a journey through the ever-evolving landscape of technology, and you might just find yourself a little bit more tech-savvy (and a lot more excited) along the way.