Search code examples
salesforceobject-relationships

Having challenges finding a referenced child object / relationship / magic


I inherited the management of a Salesforce org for an NPO that works with Students.

Our Students have Enrollments (in schools).

When an Enrollment is created on a Student, its demarcated via a Checkbox (binary) as the "Most Recent Enrollment" by the creator.

There are multiple Enrollments on any given student. Information only from the most recent Enrollment, like the City, is rolled up to the Student object.

The way that it is rolled up, are formulas such as "Most_recent_enrollment__r.City__c" .. while there is no "Most_recent_enrollment" object, and fields from it will not show up in any field-viewing pathway that will be shown to you by the "insert field" button, inside the formula creation window.

Would anyone have any insight how this is being done or where to look?


Solution

  • By your latest comment i would conclude that everytime a child enrollment record is added that is linked to a student record, for that student record the most_recent_enrollment__c lookup field is set to that latest enrollment record. This is likely done by an apex trigger.

    Once having that direct lookup relation from the student record to the enrollment record, using this is fairly easy in formula's, and works as you have described above: Most_recent_enrollment__r.City__c

    This formula goes through that lookup relation and displays the city__c field of the enrollment record. You could do the same for any other field in other formula fields.