Dynamic model for File Upload page include

  • 1
  • Question
  • Updated 2 years ago
I would like to build a universal UploadFile page to include in places like drawers, where I can have a button called "Upload File" and shows a popup with the page include. That page include would get fed an id parameter, but I would like to build a dynamic model that can look at the id getting loaded and decide what type of SObject that is and then use that record as the basis for the File Upload component in the page include. Is this possible?
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb

Posted 2 years ago

  • 1
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
Let's say you have 6 objects that may be involved. You could build 6 models on the page include with 6 file upload components. Then you can set a condition on each model to receive a URL parameter or abort query if that parameter is not In the URL. Then on page load you would have 1 model with 1 row and 5 models with no rows. Then set the rendering on each upload component to only display if it's corresponding model has rows. Only one uploader will display at a time and it will correspond to the object that was passed in from the URL parameter.

A true version of what you are talking about is a thing of lore. Probably could be done with JavaScript and or custom component.
(Edited)
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb
Thanks Raymond, that's exactly how I'll build it out for now. Probably a lot more stable that way anyway.