Salesforce developers often use the objects called Note, Attachment, and Document when working with SOAP API. But most of the time, they deal with documents. Here is a short post that describes what Documents are in Salesforce, and considerations that need to be observed when dealing with them.
What Is a Document?
A Salesforce Document pertains to a record that represents a file uploaded by the user. Simply put, a user uploads a specific document to Salesforce and tags it under the Document object. Document is a type of record that is not attached to any parent object.
Document objects are helpful for when developers need to insert important files as they work on their codes.
On-Demand Document Fields
Here are some of the common fields that are used when working with Document objects:
- AuthorID – Who created the document.
- Body – The actual encoded file data. This is a required field.
- BodyLength – File size expressed in bytes.
- ContentType – Specifies the type of document content
- Description – A short explanation about the document.
- FolderID – The ID of the specific folder containing a certain document.
- Name – A required field pertaining to the document’s actual name.
- Url – A specific URL pointing to the document’s file.
Other fields you will encounter are DeveloperName, Keywords, IsBodySearchable, IsBodyDeleted, IsInternalUseOnly, IsPublic, LastReferencedDate, and LastViewedDate.
Considerations When Creating On-Demand Document Objects
Developers cannot simply upload any kind of on-demand documents that they want. There are some considerations that they have to take into account when working with on-demand document objects:
- The maximum document size that can be created or uploaded as an object is 5MB.
- Enterprise-grade documents such as PDFs, Word, PowerPoint, Excel, and HTML emails can all be uploaded as a Document object.
- On-demand Document objects are stored in Folders accordingly.
- You need access to a certain document Folder as well as the “Edit” permission so that you can create or update any kind of document object in that particular Folder.
Summing it up
You can add Document objects on-demand to your code as you work on Salesforce. These Document objects contain essential files that you may include in your own app development process.