create records with filter on popup

  • 1
  • Question
  • Updated 5 years ago
i have a table with a list of products
i added a row action that opens a popup form
the form shows that the correct row of the model for products is selected

on that form I have a table that has product_material as a model
that model is filtered by by the current row in the product model

when the popup form opens it displays no records for materials for the current product

if i click on the plus i get a record
which has the product id of the current product in its "service" dropdown
however, if i enter a product in the "materials" dropdown
the "service" id disappears

nevertheless if i save the record it makes the correct entry in the product materials table, with one product entered as the service and the other entered as the "material"

what i don't understand is why the entries don't show on the popup form if i then open it again... the table on the popup form is filtered by a "field in another model"
that that model is the products model that is underlying the table with the list of products.... when i click on a row icon in that table... doesn't that make that product the selected row in the products model ? shouldn't that then run the filter on the table in the popup and show the product materials with that product id ?

Photo of ktyler

ktyler

  • 9,244 Points 5k badge 2x thumb

Posted 5 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Ken our reccomended way for showing related data within popups is to use a page include in the popup.  This was a under-reported addition of the Spring release.  We should probably do a fuller exploration. 

With a page include, you can more specifically designate the behavior of the popup - what the context is when that related page loads up.  If you put it all directly in the popup you are depending our the automatically applied data conditions which - though exposed in the xml - are not well presented to the user who is building declaratively. 

The strangeness of the condition - applied prefill getting thrown out when you choose another reference field is stranger.  I'm going to dig into that later.  

But hopefully this initial answer will keep you moving through your weekend.