var CHILD_RELATIONSHIP_NAME = 'Experiences__r', // Replace with the name of your child relationship Order_Number_Show__c; // Replace with the name of the field on the child relationship you want to reference var field = arguments[0], value = arguments[1], $ = skuid.$, caseModel = field.model, caseRow = field.row, experiences = []; // Get the experiences child relationship if (caseModel.getFieldValue(caseRow, CHILD_RELATIONSHIP_NAME)) { experiences = caseModel.getFieldValue(caseRow, CHILD_RELATIONSHIP_NAME).records; } // Loop through child records; check if the "Show Order Number" field is true for any of them var showOrderNumber = false; if (experiences.length > 0) { $.each(experiences, function(i, record) { if (record.Order_Number_Show__c === true) { showOrderNumber = true; } }); } if (showOrderNumber === true) { // Run the standard field renderer skuid.ui.fieldRenderers[field.metadata.displaytype][field.mode](field,value); } else { // Do nothing
}
The purpose of this code is to render custom field Case.Order_Number__c when any child experience has custom field Experience.Order_Number_Show__c set to true.
Please advise