FIle Upload component not working properly within a drawer.

Hi Skuid Community, I have a Table to store the list of invoices details. For each Invoice Detail, There will be an attachment of Invoice copy (Attachments object is used to save all these attachments). So i created a drawer and within that drawer, by using the file upload component i wanted to upload the Invoice as an attachment. The drawer has a file upload component and below the file upload component, there is a table component (which shows the related attachments uploaded). It looks like this My problem here is, i am not able to filter the attachments related to the Invoice detail. For example the attachment “My invoice attachment” under the “test invoice” record. But even when i open any other invoice record i am seeing the same attachment popping in the table. How can i filter attachments based on the Invoice record ID? Right-now, the condition that having on my attachments model looks like this Invoice Line Item is the model where i have all my invoice detail records and Parent id is the .ID of the parent record from the attachments. Can anyone help me out with this issue?? Thanks.

Drawers have before load actions. You should be able to add a before load action to activate and set the value of a model condition. It will respect row context so you can typically use {{Id}} as the value for the condition. Then you need to requery that model. This way, every time you open a new drawer, it will limit the rows to those that match that row.

Thanks Raymond. I added the before load condition and when i try to preview the page, i’m getting the following error.
How to overcome this error?

Best guess is that it is one of the fields you are including in your model. I would eliminate one field at a time from your model and test.

This heap size error is indicating that the query tried to pull more data than Salesforce allows at once, which is capped at about 6 megabytes. When you’re setting up your model to pull the attachment, you will actually want to use the relational field, which looks something like this:

Invoice__r.skuid__AttachmentId__c

If you simply try to use Invoice__c itself in your model, the query tries to pull the file’s actual data/code encoded into Salesforce. Instead, try using the [fieldname]__r.skuidAttachmentId__c field to serve your attachments. 

I’d also like to encourage you to check the context conditions on your drawer, and make sure the context is doing its part to make sure the drawer will have the relevant content for its associated record. The tutorial here should help; specifically right around step 5. 

It Worked. I solved this Heap usage limit error. I made the changes as per what you said on top. But still the Attachments related drawer is not working as expected. the condition and before load action that i am using now looks like this I also Added a context condition when the drawer opens. that condition looks like this Whenever i have a context enabled, the table is completely empty (no records within the attachments is showed up). When i don’t have the context condition, all the attachments records are showed in the table. Where am i going wrong?