You need to sign in to do that
Don't have an account?
Shyamala Varadharajan
Update Existing Record before Inserting new record to avoid Duplicates
Hello,
I have a Custom Object with 4 fields and 1 Date Field. If I try to create a new record with same values I need to check the old records and if the record persists then need to update the old Record with new Date . How can we achieve this. Please help
I have a Custom Object with 4 fields and 1 Date Field. If I try to create a new record with same values I need to check the old records and if the record persists then need to update the old Record with new Date . How can we achieve this. Please help
4 fields values should match old record?
Yes 4 field values should match old record value..This is the code I have tried but the issue is it's updating old record as well as creating new record with same values which cause duplicates.
public class duplicateHandler {
Set <String> agencyTypeSet = new Set<String>();
agencySet.add(custMap.Agency__c);
agencyTypeSet.add(custMap.Agency_Type__c);
if (custMap.Start_Date__c != oldCust.Start_Date__c) {
oldList.add(oldCust);
}
}
}