I’m trying to load only ParentObject__c records where ChildObject__r.records != null. Is that possible? I figured out I could hack the XML to do this with render conditions, but when I tried that with the Model conditions it wouldn’t work, it gave an error that it couldn’t recognize the field ChildObect__r.records (or ChildObect__r.records.0.Id etc, tried a few variations).
Is it possible to hack the XML this way, or do I just need to load all the possible Child Records in a new model and then use that as a condition for loading my parent model?
Are the child records master-detailed? If so, use rollup to count them. Otherwise you can use DLRS to do the same thing.
https://github.com/afawcett/declarative-lookup-rollup-summaries
Sometimes the simplest answer is the best. Actually most times I guess. That worked. Thanks Pat!
This is a perfect use case for a “Result of Subquery” Condition. Result of Subquery Conditions are ideal for finding parent records with/without child / related records, optionally filtered by “Subconditions”. For instance if you wanted to find Account records with child Contacts, you would create a “Result of Subquery Condition” on your Contacts Model like this:
Field: Account Id
Operator: in
Content: Result of Subquery
- Join Object: Contact
- Join Field: AccountId
This will show just Accounts that have Contacts.
AHA! I knew there was a way to do it. Thanks Zach! That worked perfect too.
Ok, so how do the subconditions work? I’m trying to do Completed__c != Yes, but I keep getting errors.
If I do Completed__c !=‘Yes’ it outputs as Completed__c !=‘Yes’ and says is not a viable character.
If I put Completed__c !=Yes it wants a colon, then if I add the colon it says Yes it not a variable.
If I put Completed__c !=“Yes” it renders the same but says that " is not a viable character.
Any ideas?
What kind of field is “Completed__c” ?
Nevermind, I was messing things up - same problem as this: https://community.skuid.com/t/subquery-error-using-like-condition
I was trying to put my subcondition in the logic field.
Ah, that makes sense. Apparently this is a common source of confusion…
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.