File upload component doesn't work in drawer on aggregate model table

  • 1
  • Problem
  • Updated 3 years ago
  • Solved
I'm getting the 'silent error' with the file upload component. It just gets stuck with the Uploading... notification/button, but does nothing.

I'm trying to put the file upload component in a drawer on a table whose model is an aggregate model. I believe I'm passing the right values to the Attachment model with before load actions. Is the file upload component getting the right context? There are no context conditions available for it, so does it know that when I point it to the parent model, it should try to attach to the row in that model that is in context?

I've had a look at this thread, and I have the local versions of the four required VF pages, if that matters in this case.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Here's a look at some of my setup.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
The File component does look for context, but it looks like aggregate models do not send context through to the components in drawers - even when the grouping is on a record Id.  I believe you failuer is not really silent,  but rather the attaachment is being connected to the first record in your list.   That is row the file object is using as parentId. 

I have been able to make your scenario work with an intermediary model that that retrieves the single record that corresponds with the row in your aggregate model table.  This condition is set and the model queried with before load actions.

Then the file component is connected to this model.

Below is my XML:

<skuidpage unsavedchangeswarning="yes" showsidebar="true" showheader="true">
<models>
<model id="Attachment" limit="20" query="false" createrowifnonefound="false" sobject="Attachment" doclone="" type="">
<fields>
<field id="Id"/>
<field id="ContentType"/>
<field id="Name"/>
<field id="ParentId"/>
<field id="Parent.Name"/>
</fields>
<conditions>
<condition type="fieldvalue" value="" enclosevalueinquotes="true" field="ParentId" state="filterableoff" inactive="true" name="ParentId"/>
</conditions>
<actions/>
</model>
<model id="SelectedAccount" limit="1" query="false" createrowifnonefound="false" sobject="Account" doclone="" type="">
<fields>
<field id="Id"/>
</fields>
<conditions>
<condition type="fieldvalue" value="" enclosevalueinquotes="true" field="Id" state="filterableoff" inactive="true" name="Id"/>
</conditions>
<actions/>
</model>
<model id="ContactAggregation" limit="20" query="true" createrowifnonefound="false" sobject="Contact" doclone="" type="aggregate">
<fields>
<field id="Age__c" name="sumAgec" function="SUM"/>
<field id="Birth_Year__c" name="maxBirthYearc" function="MAX"/>
<field id="Id" name="countId" function="COUNT"/>
</fields>
<conditions/>
<actions/>
<groupby method="simple">
<field id="AccountId" name="AccountId"/>
<field id="Account.Name" name="accountName"/>
</groupby>
</model>
</models>
<components>
<skootable showconditions="true" showsavecancel="false" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="false" model="ContactAggregation" buttonposition="" mode="readonly">
<fields>
<field id="AccountId" name="AccountId" valuehalign="" type=""/>
<field id="Account.Name" name="accountName" valuehalign="" type=""/>
<field id="Age__c" name="sumAgec" decimalplaces="" valuehalign="" type=""/>
<field id="Birth_Year__c" name="maxBirthYearc" valuehalign="" type=""/>
<field id="Id" name="countId" valuehalign="" type=""/>
</fields>
<rowactions>
<action type="drawer" label="Attachment Drawer" icon="sk-icon-magic">
<drawer title="Drawer Area" width="90%" closehandle="true">
<components>
<file storeas="record" displayas="filename" model="SelectedAccount"/>
<skootable showconditions="true" showsavecancel="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="true" model="Attachment" buttonposition="" mode="read">
<fields>
<field id="Id"/>
<field id="ContentType"/>
<field id="Name"/>
<field id="Parent.Name"/>
</fields>
<rowactions>
<action type="edit"/>
<action type="delete"/>
</rowactions>
<massactions usefirstitemasdefault="true">
<action type="massupdate"/>
<action type="massdelete"/>
</massactions>
<views>
<view type="standard"/>
</views>
</skootable>
</components>
<beforeload>
<action type="setCondition" model="SelectedAccount" condition="Id" value="{{AccountId}}"/>
<action type="setCondition" model="Attachment" condition="ParentId" value="{{AccountId}}"/>
<action type="requeryModels" model="Attachment" behavior="standard">
<models>
<model>Attachment</model>
<model>SelectedAccount</model>
</models>
</action>
</beforeload>
</drawer>
</action>
</rowactions>
<massactions usefirstitemasdefault="true"/>
<views>
<view type="standard"/>
</views>
</skootable>
</components>
<resources>
<labels/>
<javascript/>
<css/>
</resources>
</skuidpage>



 Let me know if it works for you.
(Edited)
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Nice work. Thanks, Rob.

And because the aggregate model doesn't pass context, we have to completely requery both the intermediary model and the Attachment model... the context conditions for the Attachment model won't work to allow us to just 'add more'. Is that correct?