Is there a way I can dynamically assign a model to a file upload component?
I am trying to create a generic page to display attachments, which will also allow users to upload new attachments and use this page as a page include across a variety of object record detail pages.
Zach helped me here https://community.skuid.com/t/get-sobject-name-from-salesforce-id with building a map of salesforce key prefixes and the corresponding object names dynamically. I am making use of this map to check against the id of the salesforce record, determining the sObject and am able to build the object model on the fly using javascript. Now, I have a file upload component on my page, to which I want to assign this newly created model.
Is there anyway I can do this? Is there any documentation on this?
Yes. It sounds like you’re talking about the parent model chosen on the File Upload.
The documentation can be found here:
https://docs.skuid.com/latest/en/skuid/components/file-upload/index.html#file-upload
UPDATE
So this is what I did. I created a generic model (called it GenericModel) on the account object (because the file upload component needs a parent model assigned to it).
And then on page load, I have a snippet that changes the ‘objectName’ property to the object of the salesforce record that was passed and also set a condition on the model to the id of the salesforce record that was passed to the page include.
And that did the job!
I know I am getting the result that I want but would this be the right approach or is there a better way to achieve this?
Thank you for posting your solution!
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.