I am trying to render a list of records (model = MedRecs) using the ID field of newly created record (model = Shipment) as a Condition.
My first model is called Shipment. Because I want to create a new Shipment record, I’ve set “Create Default Row if Model Has None” to TRUE and “Load Model Data on Page Load” to FALSE. Max # of Records = 1. The user fills in some fields for the Shipment model and saves.
My second model is called MedRecs. MedRecs are displayed in a table below the Shipment field editor. The table is conditionally rendered: it does not show up until the new Shipment record has been saved.
When the MedRec table does show up, I only want it to display records where a lookup field on the MedRec (MR_Holder__c) matches a lookup field on the new Shipment record (Ship_From__c). I’ve tried to build the MedRec condition many different ways: MR_Holder__r.Id = (Shipment)(Ship_From__r.Id); MR_Holder__c = (Shipment)(Ship_From__c).
If I set “If no row in Source Model, then…” to “Abort this model’s query”, I see no MedRecs. If I set it to “Deactivate this Condition,” I see all the MedRecs.
So - why isn’t the new Shipment identified as a row in the Source Model? I created a second table on the page that, like the MedRec table is conditionally rendered - it only shows up when the new Shipment record has been saved. This table has the “Shipment” model as its source model, and it shows the single new Shipment record.
I’d appreciate feedback on what I’ve done wrong here - thanks for the help.
Question
Use new record ID in condition on another model
This topic has been closed for replies.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
