Drawer for a Table row that only shows records related to the record for that row

  • 2
  • Question
  • Updated 2 years ago
  • Answered
Is it possible to filter records shown in a drawer so that the only records shown in the drawer are records linked to the row that contains the drawer? If it is possible, is it possible with just the standard Skuid components (i.e. no Javascript required)?

An example is much easier to explain: a page with a table that shows opportunities, and a drawer on each table row that shows opportunity line items for the opportunity in the row?

A yes or no is fine at this stage - I'm new to Skuid, so I'm happy to go off and learn more about snippets et al if that's required, but I wanted to check if there was a non-code way of doing it before I did that. Of course, any helpful pointers to tutorials or code are welcome ;) From what I've read up on and experimented with, I don't think it is possible without code, but may not be using the right search terms to locate the right answer.

Thanks in advance.
Photo of Gary

Gary

  • 1,518 Points 1k badge 2x thumb

Posted 4 years ago

  • 2
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Gary,  we are currently working on a fix to make this completely declarative in all situations. Currently you can get it to work if you load ALL your related list data on page load,  which is only reasonable in very small orgs.  To do this go to the advanced tab of the related list model and make the "Max Rows" value blank. 

But to get the filter to work in the drawer,  put a table in the drawer and look for the Context tab of the table properties. 

Here build a context condition that ties the drawer records to the ID of the containing record.   See below: 


In an upcoming release we will make it possible to load the related data after the filter is applied.  This will allow you to interact with your data much more efficiently. 
Photo of Conlan O'Rourke

Conlan O'Rourke

  • 3,280 Points 3k badge 2x thumb
Hi Rob,

I see this post is from 2 years ago, so I'm wondering if there has been a fix released by now?

Thanks,

Conlan
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Yes, the fix was released.  See below. 
Photo of Conlan O'Rourke

Conlan O'Rourke

  • 3,280 Points 3k badge 2x thumb
Yes! Working great. Thanks Rob
Photo of Gary

Gary

  • 1,518 Points 1k badge 2x thumb
Rob, thanks for your response. I wondered if the Context filters would help, but couldn't find information about it; however, the approach you describe helps explain its purpose! This approach may actually work for us as the data will be limited by account in the first place anyway.

Is there any ETA on the fix you mention? Is it a feature for the next season's release, or a patch that will be released once it's ready?
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
 Gary - we intend to complete a fix for this in an upcoming point release.  It should be very soon.
Photo of Gary

Gary

  • 1,518 Points 1k badge 2x thumb
Good to hear, look forward to it! :)
Photo of Peter Bender

Peter Bender, Champion

  • 6,246 Points 5k badge 2x thumb
I'm trying out the 5.15 nightly release which seems to have a fix for this issue. (One of my clients would like to see this work as a proof of concept before considering a separate page.) I think I'm close, but not sure if I can't get it to work because of a nightly build problem or my settings just aren't right yet. I can see existing records in the drawer, but can't seem to make a new row appear, and when I save I get an error saying "Required fields Missing: [Student Folder]".

Drawer Actions:



Drawer sub-object basic settings:


Drawer sub-object model condition:


Drawer table layout basic settings:


Drawer table layout context settings:
Photo of Peter Bender

Peter Bender, Champion

  • 6,246 Points 5k badge 2x thumb
I'm trying out the 5.15 nightly release which seems to have a fix for this issue. (One of my clients would like to see this work as a proof of concept before considering a separate page.) I think I'm close, but not sure if I can't get it to work because of a nightly build problem or my settings just aren't right yet. I can see existing records in the drawer, but can't seem to make a new row appear, and when I save I get an error saying "Required fields Missing: [Student Folder]".

Drawer Actions:



Drawer sub-object basic settings:


Drawer sub-object model condition:


Drawer table layout basic settings:


Drawer table layout context settings:
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Peter, generally if you are using before load actions to set the model conditions - you do not need to add context conditions on the tabel in the drawer.  You only need them in one place or the other.  That may not be the only thing that is problematic,  but its what jumped right out at me... 
Photo of Peter Bender

Peter Bender, Champion

  • 6,246 Points 5k badge 2x thumb
I was wondering about that. But, when I remove the context conditions, then every time I open a drawer, I get all of the child records in the model, not just the ones for that parent record. And I have to have the "before load" action to get the new child records.

Logically I think I need both an action to populate child records for that specific parent when the drawer is opened, and a context condition to only show the ones for that child in that drawer. With both of these set, I do get the correct existing records to appear in each drawer, but clicking on the "plus" icon in the drawer table doesn't make a new row appear - it does nothing. Interestingly, it does enable the save/cancel buttons, though, and if I think click those buttons then I get that same error. So the button must be making new model records but they just aren't getting into the drawer table?
Photo of Peter Bender

Peter Bender, Champion

  • 6,246 Points 5k badge 2x thumb
Just to clarify: updating and deleting existing records in the drawer seems to work fine, so it looks like the only problem is adding new ones.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
I'm guessing that using the "add" button on the table adds a new row to the model,  but does not know to add it specifically to the context of the row in which the drawer is opened. 

You may need to add a page title component into the drawer that is tied to the model of the primary table.  (So you have the row context) and in this page title put a button that adds a new row to the related list model - and sets a default field to the relation id (back to the primary tabel).  That may be overkill - but I think it will work. 

We'll confer in the next day or so (whenever the dreamforce onslaught abates) and think about this case. 
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
One other thing I notice.  Your Drawer Sub Object settings include "create default row = on"   I would turn this off.  The "add row" actions in your drawer will create the new row and pass the drawer's context into that row. Both of the data settings should be off. 

I was able to create a situation akin to yours,  and use the standard table inline add button to add rows to the model.  The new rows appeared in the table and took the correct context.  See below. 

Photo of Peter Bender

Peter Bender, Champion

  • 6,246 Points 5k badge 2x thumb
Strange - I can't seem to get new rows to work. Well, I'll stop by your #DF14 booth next week and one of the experts can help me figure it out :)
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
That would be great Peter.  We'll be in the DevZone on the second floor. 
Photo of Peter Bender

Peter Bender, Champion

  • 6,246 Points 5k badge 2x thumb
FYI, for anyone following along, I just had a mistake - was using a relationship.ID field in one place instead of just the relationship field. Works just fine now.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
For what its worth.  This issue was fixed in late 2014.   Here is a tutorial explaining how to include child records from a second model into the drawer contents of a first model.  

http://help.skuid.com/m/supercharge-your-ui/l/269735-add-nested-rows-to-your-table-with-drawers

Note - to make this work you have to follow ALL the steps of the tutorial.  This is not a simple one step process. 
Photo of Steve Chilcoat

Steve Chilcoat

  • 522 Points 500 badge 2x thumb
This is working for me with one exception.  You cannot use "allow inline record create" with this method because the Context condition is only pulling back records where the AccountID matches.  Any suggestions on how to allow this feature?
Photo of Gregory Smith

Gregory Smith, Employee

  • 304 Points 250 badge 2x thumb
I was having this same issue, make sure you add the parent field to the model that you are using in the context condition.