trigger setCertificationToFailed on Exam__c (after update) {
List<Exam__c> ExamList = new List<Exam__c>();
ExamList = [SELECT Id, Exam_id__c, Exam_state__c, doNothingExam__c, Certification__r.Id, Certification__r.Exam_state__c, Certification__r.Name FROM Exam__c
WHERE Exam_state__c in ('Failed') AND Certification__r.Exam_state__c in ('Active') AND doNothingExam__c = True];
}
I need to identify if each row inside this List share similar values with other rows of the same list.
eg. Row 1 => Certification__r.Id = ABCD, Exam_id__c = 1234, Row 2 => Certification.Id = EFGH, Exam_id__c = 0000, Row 3 => Certification.Id = ABCD, Exam_id__c = 1234
Above Row 1 and 3 have same Certification__r.Id, Exam_id__c. How can I identify this through a code?.
Note that only Certification__r.Id, Exam_id__c should be compared with every row. If both of them match together with another row, then it should change Certification__r.Exam_state__c to 'FAILED' from 'Active'
Below in this picture, you can notice similar rows with similar Certification__r.Id, Exam_id__c values.