You need to sign in to do that
Don't have an account?
Robert Wynter
check if Affiliation record already exists
This could inserts a related affiliation record to contact on upload. I need to add some kind of if statement to have it skip if the Affiliation already exists.
//Updated by Robert Wynter for Agent Affiliation private hed__Affiliation__c createAgentUpsertAffilFromInteraction(Interaction__c interaction) { hed__Affiliation__c newAffil1 = new hed__Affiliation__c(); intMappingService.applyDataToSObject(interaction, newAffil1); newAffil1.Upsert_Agent_Key__c = interaction.Contact__c + interaction.Agent_Key__c; newAffil1.hed__Status__c='Current'; newAffil1.hed__Role__c='Applicant'; newAffil1.hed__Account__c= interaction.Agent_Key__c; newAffil1.hed__Primary__c=True; newAffil1.hed__Contact__c=interaction.Contact__c; upsert newAffil1; system.debug(newAffil1.hed__Account__c= accID); system.debug(newAffil1.hed__Contact__c=conID); return newAffil1; }
Robert Wynter
I needed to tweak the INT_InteractionProcessor.cls to include adding an addition Affiliation to the Contact when the record includes an Organization Agent. The code below works for the first record upload. but because the Contact would be on the flat file upload multiple times. It fails on the second upsert. I need a way to have it check if the Affiliation does not exist then add else skip.
Robert Wynter
figure it out. I forgot the Bind Variable colon(:) in my SOQL query. my only concern now is if it's Bulkified compliant. When it's in production We will be mass uploading over 100,000 records.