Add Custom Attribute to File Uploads
Add Custom Attribute to File Uploads
While Salesforce provides users the ability to upload documents and associate them to a variety of objects. It does not provide administrators the ability to restrict users to the types of documents or a way for the user to classify the documents when uploading. I ran into this issue when working on an integration between Salesforce and an accounting system.
When a Salesforce order was completed, it was transferred to the accounting system to be invoiced.
Various types of documents were being uploaded and associated to the order.
The accounting team only wanted the "final contract" and "Invoice Attachments" transferred to the accounting system.
Neither the sales team, legal, or accounting team wanted to look through all the documents to figure out which one was the right document.
A combination of:
Adding a custom field to the ContentVersion object.
Source code for the Salesforce Labs "Enhanced File List". (source code Github repository).
Custom Code.
In Salesforce Add a custom field to the "ContentVersion" object.
*** Important *** In order for this to work correctly you must adhere to specific Salesforce rules:
The field type can only be of type text or picklist.
The API name of the custom field must end with "fileupload__c". Example: Category_Type_fileupload__c
If you do not follow these two rules everything will seem to function, but no data will be saved in the new field.
This step will require VS Code with the Salesforce extensions (see links at the bottom of the page for help). Once VS Code is properly installed and configured, you will need to download/clone the source code for Salesforce Labs "Enhanced File List" (source code Github repository).
Open the Enhanced File List source code in VS Code.
Custom Code
TO BE Done
References and Links