You need to sign in to do that
Don't have an account?
Robert Wynter
need help please altering apex code to include two additional custom fields in the duplicate audit
We have an Installed unmanaged package and I need help reconfiguring the duplicate check of the apex code to include Recruitment_Interest__c and Term__c fields. But only when the Interaction_Source__c Equals "Student Information System" ELSE the existing Duplicate check of Last Name, First Name and Email can check.
/** * @description Does basic pre-processing for duplicates of the Interactions in the import. If it finds a possible * duplicate, it removes it from the import and flags it for future processing. * @param interactions, the List of new Interaction__c records. * @return the List of filtered Interaction__c records for processing. */ private List<Interaction__c> duplicatePreProcessing(List<Interaction__c> interactions) { // If the custom setting is turned off, return the List and do not run any pre-processing for duplicates. if (Interactions_PreProcessing__c.getAll().values() != null) { for (Interactions_PreProcessing__c ipp : Interactions_PreProcessing__c.getAll().values()) { if (!ipp.Active__c) return interactions; } } Map<String, Interaction__c> filteredMap = new Map<String, Interaction__c>(); for (Interaction__c interaction : interactions) { String filterKey = interaction.First_Name__c + interaction.Last_Name__c + interaction.Email__c; if (!filteredMap.containsKey(filterKey)) { filteredMap.put(filterKey, interaction); } else { interaction.Interaction_Status__c = 'Audit Required'; String error = ' Reason: this Interaction was not processed because it is a possible ' + 'duplicate of - ' + filteredMap.get(filterKey).Id + ': ' + filteredMap.get(filterKey).First_Name__c + ' ' + filteredMap.get(filterKey).Last_Name__c + ' ' + filteredMap.get(filterKey).Email__c; interaction.Audit_Reason__c = error; dupeInteractions.add(interaction); } } return filteredMap.values(); }