You need to sign in to do that
Don't have an account?

duplicate value found: <unknown> duplicates value on record with id: <unknown> in TEST CLASS
Hi,
I have custom field called Email__c and marked it as Unique .
When i insert lead using some apex logic with duplicate Email__c then it shows error in debug log like
But when insert the duplicate lead from test calss then giving the below output.
How to get Email__c in the place of "<unknown>" in test class. Please help. Due to this i am not able to cover some lines of code.
Main class code here.
in the below code not enteringing into if statement because of "<unknown>" is coming instead of "Email__c"
I have custom field called Email__c and marked it as Unique .
When i insert lead using some apex logic with duplicate Email__c then it shows error in debug log like
duplicate value found: Email__c duplicates value on record with id: 00Q1700000DfdUO;
But when insert the duplicate lead from test calss then giving the below output.
duplicate value found: <unknown> duplicates value on record with id: <unknown>;
How to get Email__c in the place of "<unknown>" in test class. Please help. Due to this i am not able to cover some lines of code.
Main class code here.
in the below code not enteringing into if statement because of "<unknown>" is coming instead of "Email__c"
for (Database.Error dbE : errorList) { //handle duplicate applicant system.debug('the sai 1st outside:'+dbE+'....'+dbE.getStatusCode()+'....'+System.StatusCode.DUPLICATE_VALUE); if((dbE.getStatusCode() == System.StatusCode.DUPLICATE_VALUE && dbE.getMessage().contains('Email__c') )) { system.debug('the sai 1st inside:'+dbE.getMessage()); String dupId = dbE.getMessage(); dupId = dupId.substringAfter('Prospect_UUID__c duplicates value on record with id: '); errList.add(handleDuplicateUUIDApplicant(dupId, NULL, leadRec.Email__c)); }
https://salesforce.stackexchange.com/questions/79799/how-to-debug-the-mysterious-duplicate-value-found-unknown-duplicates-value-o