I’m currently working to prep our org for using Files rather than Attachments, including in SKUID models and components but am running into some roadblocks. We have a table that the end user needs to essentially “Clear Out” the file from the table (ideally delete, but simply being left off the UI via condition would be fine too as a workaround) once they have moved the file to a different record.
Files don’t allow someone who doesn’t own the file to delete it without Manage All Data (https://success.salesforce.com/ideaView?id=0873A0000003XWGQA2), so I figured a workaround would be to create a custom boolean field on the ContentVersion object that denotes they have reviewed and moved the file. The SKUID table would then have a condition that drops it off the list if the file is checked “True” for this.
However, I’ve tried it two ways and have two different issues preventing this solution.
1. ContentDocLink Attempt: When I try to use the ContentDocLink model/table, I can’t edit the custom field on the ContentVersion record via ContentDocLink Model. The files’ privacy are “Visible to Anyone with Record Access” and all users with access to the record can see them. But unless they own the file, they can’t delete it as mentioned before. And it doesn’t appear that the custom field can be edited from this table either, so the files are stuck on the table.
2. Content Version Attempt: When the model is based on ContentVersion, the custom “Reviewed” custom field is editable and the file drops off the table per the conditions once it is checked and saved. However, with this, I have a sharing issue. Even with "Visible to Anyone with Record Access” as the File Privacy, the file only shows up to users with access to the record if it was shared directly with them or they have View All Data permissions.
I’ve read through this: https://community.skuid.com/t/populate-custom-field-on-file-upload and this: https://community.skuid.com/t/update-record-created-via-the-upload-file-component, the former I’m going to dive into deeper but it’s from four years ago so want to see if anyone has other ideas. Please let me know if you have suggestions or have run into the same problem.
Consider:
Instead of inline editing the field, use a row action button called “Reviewed”. That row action button allows you to have an action sequence. That action sequence could be used to update both models.
So…
You would display a table connected to contentdocumentlink, then set a condition on the Content version model that restricts the records in that model to just the record you are working on in the contentdocumentlink table. Then query the content version model so that it now only has one row. Then update rows to check your review box and save the content version model.
Thank you so much! This almost did it. The user doesn’t have modify all data so they are unable to update the “Reviewed and Filed” field, so it won’t save it from their profile. I think I’ll need to use Libraries to enable them to update the custom field since they do not have modify all access. I know you did a similar thing but for the file Uploader (https://community.skuid.com/t/populate-custom-field-on-file-upload)… do you have any pointers on that beyond what you listed out (it’s a different use case but maybe similar enough?).
I remember I had to use libraries and when I uploaded a new file, I had the action sequence contribute the file to the specified library. Then, in order for users to have the right permissions, they had to be manually assigned to have access to that library and then those authorizations had to be maintained. That aspect was messy, but the resulting functionality worked great.
Due to the complexities and the fact that exporting and importing content files is a really pain with salesforce, I would only use Salesforce for document storage if there is some special value to it or if you are in need of a complete streamlined system including document management.
I now use an inline frame displaying a cloud document storage service (Egnyte) and I use URL parameters to load up the correct folder/file in the egnyte system.
Yes indeed - files have been giving me a lot of headache, but we are transitioning this client to Lightning so they’ll have to transition all their attachment lists to file lists (including all SKUID pages…) - they definitely use attachments for a lot of their business reqs and like to have everything in SF… but I may start looking at workarounds.
Following up on this issue, I created one library for this set of users to have their files in (small team that work together on these records, not worried about file privacy between records for this particular record type/end user). I’ve given the public group with these users a standard Authoring library permission (pretty much all but Manage Library). They can add content to the library directly no problem…
I’ve added the action to create a new row in the ContentWorkSpace model, which adds it to the above library before running the field update on the ContentVersion record. Admins are able click the row action, which adds it to the library. However, non-admins aren’t able to do so and get a permissions error… did you run into this/did you find a workaround?
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.