Render condition based on child records

  • 2
  • Idea
  • Updated 3 years ago
  • Under Consideration
Is this something that's already been suggested? I have a table with a drawer of related records. It would be really cool to be able to render a drawer action based on whether a table row has any related child records.
Photo of Emily Davis

Emily Davis, Employee

  • 3,502 Points 3k badge 2x thumb
  • hopeful

Posted 3 years ago

  • 2
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb
Great idea! You can achieve this in the XML, someone else may know a different way --

Set a render condition for a specific field to != Null - blank value on your row action, then search by your field name to look for a section similar to this in your XML:

                             <rendercondition type="blank" fieldmodel="ModelName" sourcetype="fieldvalue" sourceproperty="hasRows" operator="!=" nosourcerowbehavior="deactivate" field="FieldName__c" value="null" enclosevalueinquotes="false"/>

Then replace the field name with either ChildName.records if it is a standard field or ChildName__r.records if it is a custom field (you can tell by looking at the child field on your field, if it says just Contacts do Contacts.records, if it says Contacts__r do Contacts__r.records)

So the resulting XML should look like:

 <rendercondition type="blank" fieldmodel="ModelName" sourcetype="fieldvalue" sourceproperty="hasRows" operator="!=" nosourcerowbehavior="deactivate" field="Contacts.records" value="null" enclosevalueinquotes="false"/>

I got this to work, let me know if you have any issues. :)