You need to sign in to do that
Don't have an account?
Edward Scott 5
Trigger not firing when using dataloader
Hi,
I was just able to get this trigger to work yesterday with the help of the community. It updates a field on the opportunity object from the opportunity team member page. It works fine whe I create an opportunity or edit one but it doesn't work when I use data loader. I am new to apex code and I saw an article about first creating a set in order to get the trigger to be a bulk trigger but I am not sure how to do it. Here is my code I was wondering if anyone could help me.
I was just able to get this trigger to work yesterday with the help of the community. It updates a field on the opportunity object from the opportunity team member page. It works fine whe I create an opportunity or edit one but it doesn't work when I use data loader. I am new to apex code and I saw an article about first creating a set in order to get the trigger to be a bulk trigger but I am not sure how to do it. Here is my code I was wondering if anyone could help me.
Trigger updateAdOps on Opportunity (after update, after insert) { // Get Ad Ops team members & put in a map of <OpportunityId,AdOpsTeamMemberId> map<id,id> mOtms = new map<id,id>(); list<OpportunityTeamMember> otms = new list<OpportunityTeamMember>([ SELECT id,opportunityId,TeamMemberRole,UserId FROM OpportunityTeamMember WHERE opportunityId IN :trigger.newmap.keyset() AND TeamMemberRole = 'Ad Ops' ]); For(OpportunityTeamMember otm :otms) { mOtms.put(otm.OpportunityId,otm.UserId); } // Re-aquire the Opportinities and Update them with the Ad Ops team member list<Opportunity> opportunitiesToUpdate = new list<opportunity>([SELECT id,Ad_Ops_Contact1__c FROM Opportunity WHERE Id IN :trigger.newmap.keyset()]); for(Opportunity o :opportunitiesToUpdate) { if(mOtms.containsKey(o.id)){ o.Ad_Ops__c = mOtms.get(o.id); } } if (util_utilities.alreadyExecuted != true) { util_utilities.alreadyExecuted = true; if(opportunitiesToUpdate.size()>0) { update opportunitiesToUpdate; } } }
[1] http://www.salesforcegeneral.com/salesforcecom-debug-logs/
[2] https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_debugging_system_log_console.htm
[3] https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_debugging_debug_log.htm
[4] https://help.salesforce.com/apex/HTViewHelpDoc?id=code_debug_log.htm
[5] https://help.salesforce.com/HTViewHelpDoc?id=code_viewing_log_details.htm
[6] https://help.salesforce.com/apex/HTViewHelpDoc?id=code_monitoring_debug_logs.htm&language=en (https://help.salesforce.com/apex/HTViewHelpDoc?id=code_monitoring_debug_logs.htm&language=en)