Check obj a and obj b fields have same values
// Replace ObjA__c and ObjB__c with your actual API names if different
List<ObjB__c> objBList = [
SELECT Id, abc__c, xyz__c, ObjA__r.Id, ObjA__r.abc__c, ObjA__r.xyz__c
FROM ObjB__c
WHERE ObjA__c != null
];
for (ObjB__c b : objBList) {
if (b.ObjA__r != null) {
Boolean isAbcSame = (b.abc__c == b.ObjA__r.abc__c);
Boolean isXyzSame = (b.xyz__c == b.ObjA__r.xyz__c);
System.debug('ObjB Id: ' + b.Id);
System.debug('abc__c same? ' + isAbcSame);
System.debug('xyz__c same? ' + isXyzSame);
if (!isAbcSame || !isXyzSame) {
System.debug('Fields do not match for ObjB Id: ' + b.Id);
}
}
}
Check obj a and obj b fields have same values
Reviewed by dasfrogpractice
on
04:07
Rating:
No comments: