Populate custom field on file upload?

  • 2
  • Idea
  • Updated 3 years ago
  • Under Consideration
I have created some custom fields in Salesforce content versions object. I would like to populate these fields on upload. The Skuid uploader, by default, lets you populate name and description. Is there a way to get the uploader to populate custom fields?
Thanks!
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb

Posted 3 years ago

  • 2
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
I should specify that I am uploading to Chatter. Thanks.
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,004 Points 20k badge 2x thumb
Currently no, there is no way to do this. I'm converting this to an Idea that is Under Consideration.
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
Thanks, Zack. Ideally, an upload would act as a new row trigger for actions on the ContentVersions object. That would solve the problem and more. Currently it only triggers a requery of ContentVersions which is helpful, because you can use that requery as a trigger for row update, but you have to update all rows in the model. If it triggered new row actions, you could populate custom fields only for the new row.
Thanks!
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
Sharing of files can be managed using the ContentDocumentLinks object. Create a new row on this object to link the the file to ANY record on ANY object including users and groups. Creating a table on ContentDocumentLinks will allow you to display all sharing access points to the file and the ability to delete any sharing access point through deleting the ContentDocumentLink row.
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
I was wrong, you can't add a new version without uploading a doc. Instead I created an edit function that opens a pop up that displays a field editor on ContentVersions object that displays LatestPublishedVersion in edit mode. Works great so far.
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
I've got everything running smoothly now. The final hurdle was sharing. If user A uploads a chatter feed file on an account and User B has access to that account, in the Salesforce File tab, the record will be accessible to User B. However, I could not get Skuid to pull in these records created by other users. The API seems to only pull in records owned or that have been explocitly shared with the user through libraries or sharing. I settled on creating a library for each of my Accounts and grabbing the Library Id, pasting it into a field on the Account record, then creating a formula field on contacts called "Account Library Id" that is equal to the Account Library ID. Now when I upload a new file and the requery of ContentVersion models occurs, I use that as a trigger to create a new row on the ContentWorkspace Object that populated the ContentDocumentId (of the uploaded document) and the Library Id equal to the Library Id that I assigned to the Account. Now I just have to do a one-time set up where I add users to specified libraries related to the accounts they work with. This too can likely be automated, but I didn't check.
Sooooo.... Based on this, to accommodate sharing, I would recommend that Skuid uploader have 2 additional settings:
1) Add to library based on merge syntax (new row on ContentWorkspace object)
2) Link to Entity based on merge syntax (new row on ContentDocumentLinks object). This allows the file to be linked to any record of any object, or libraries, or users, or groups.
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
I also create a "folders" object and related it to ContentDocument Versions. This gives me more formalized structure than tags. I have created some stock folders and shared then across the organization, but users can create their own as well. Folders work for organization plus as extra layers of permissioning if needed.
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
Lastly, I created a simple version of the file manager which I place in record detail pages and limit the records to just those pertaining to the record. I also created an advanced version that allows for view, edit, delete, sharing, contribution to library, and content delivery of all files the user has access to which is so much easier to use and understand than the Salesforce user interface for content (in my opinion)
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Thanks for documenting these ideas so extensively.  Lots of good stuff here to chew on...