You need to sign in to do that
Don't have an account?
Suhaas Kapardhi B S
Hi, how do I un-Bulkify this trigger on opportunity
trigger EmailUpdation on Opportunity (before update) {
Set<Id> accId = new Set<Id>();
Set<String> oppEmail = new Set<String>();
Set<String> oldEmail = new Set<String>();
List<Opportunity> accRelaOppEmail = new List<Opportunity>();
for(Opportunity opp: Trigger.new){
oppEmail.add(opp.Email__c);
accId.add(opp.AccountId);
}
accRelaOppEmail= [Select Id, Email__c from Opportunity where AccountId in :accId and Account_Email__c in :opp.Email__c];
for(Opportunity opp: accRelaOppEmail){
oldEmail.add(opp.Email__c);
}
for(Opportunity opp: trigger.new){
if(oldEmail.contains(opp.Email__c) && oldEmail.size() != accRelaOppEmail.size() ){
}
}
}
Set<Id> accId = new Set<Id>();
Set<String> oppEmail = new Set<String>();
Set<String> oldEmail = new Set<String>();
List<Opportunity> accRelaOppEmail = new List<Opportunity>();
for(Opportunity opp: Trigger.new){
oppEmail.add(opp.Email__c);
accId.add(opp.AccountId);
}
accRelaOppEmail= [Select Id, Email__c from Opportunity where AccountId in :accId and Account_Email__c in :opp.Email__c];
for(Opportunity opp: accRelaOppEmail){
oldEmail.add(opp.Email__c);
}
for(Opportunity opp: trigger.new){
if(oldEmail.contains(opp.Email__c) && oldEmail.size() != accRelaOppEmail.size() ){
}
}
}
Please use below code:-
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh
All Answers
Please use below code:-
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh