Solutions for uploading a file to a new record

  1. In situations where a user is creating a new record, providing the option to upload a file to that record becomes tricky because the record must be saved before uploading a file. Traditionally I have solved this one of two ways

    Hiding the file upload option until a user clicks a button that triggers a save action, but this makes uploading a file a 2 step process - not the best user experience.

  2. Saving the record right after creation so that the file upload is immediately available. The problem is that this doesn't work well if there are required fields that must be filled out before saving, and you have to deal with deleting the record if the user decides to cancel the process.

I thought I would put this out to other Skuid wizards to see if anyone has come up with a more elegant solution to this tricky scenario.

The amazing @Chris_Stern discovered a solution that Salesforce actually uses in some of thier OOB functionality. The file upload component is initially bound to the current user record - which is of course saved and available to the current user. This allows the file to be uploaded at any time. Then when the new record is saved - an action sequence triggers to reparent the file to the newly saved record.

He also included a big of javascript to remove the file from the user record if the page is abandoned before the new record is saved.

I’ve asked him to document that solution in Skuid labs. ( https://github.com/skuid/skuid-labs ) because it worth keeping alive.

We added Chris’s great solution here: https://github.com/skuid/SamplePages/tree/master/Salesforce_Advanced/Create_Record_and_File

Leave it to the original Skuid Wizard to provide the answer!

Thanks, this is great - exactly the kind of trick I was hoping to find.

Kudos to @Chris_Stern!