I have a page containing a “parent” model called “Workshop” and a table beneath it where users can create rows for “Workshop Attendance”. When users click the green plus icon in the table, it fills in the parent record automatically in the lookup field (Excellent!). However, when I do so and save the page, it throws the error “Invalid Reference Id: Workshop” and no child records in the table are saved. What am I’m missing?
Peter, I ran into this a week or so ago. Does the workshop attendance model have a filter on the Id of workshop as a url param ? Is the field Workshop_Id__c in the workshop attendance model ?
Nope, I have neither of those situations. I do have the Workshop_Attendance__c.Workshop__c field (the lookup from attendance to workshop) on the model, and it shows up in the table fine. FYI, I have lots of models on this page, actually, one of which is a Class, whose ID is passed to the page via URL (Workshop has a lookup to Class).
Peter, can you send us the XML for this page?
Emailed to you & Anna - Thanks!
Peter, Can you try reordering these two Conditions in your Workshop Attendance model:
<conditions logic="1 OR 2"> <condition type="modelmerge" value="" field="Workshop__c" operator="=" model="Workshop" enclosevalueinquotes="true" mergefield="Id"/> <condition type="blank" value="null" field="Workshop__c" operator="=" enclosevalueinquotes="false"/> </conditions>
You should be able to reorder just by dragging in the Builder. We think that the issue here is that, when new your users click to create a new Workshop Attendance record, Skuid is (helpfully) using the Conditions in your Model to pre-populate the new records’ “Workshop__c” field with the corresponding Workshop’s Id. But, because you have OR logic here, and because of the order of the Conditions, Skuid is first using the Model Merge condition, then it is overwriting the value with null. So, switching the order of your conditions should change this! We’ll see if there’s some way we can make this not happen in a future version of Skuid.
I wasn’t able to drag/drop conditions, but i just deleted the first one and recreated it, emulating the same thing, and now it works. Thanks! And yes, this should be pointed out / documented or worked around so builders don’t face this. I would never have figured that out.
Glad it worked - and, definitely agreed about us changing to make it so that this doesn’t happen.
I’m running into the same error, but I only have one condition: I have two very similar pages, on different objects but with the same approach & condition, and one works while the other gives me the “Invalid Reference Id” error. I tried deleting and re-creating the condition (just in case something was off/odd), but no joy.