You need to sign in to do that
Don't have an account?
Apex Trigger
Hi All ,
I have written this trigger . Its working fine for the single record and i am not sure with whether this trigger work well for bulk operation .
I don't know whats work with it. Can anyone help me out of this.
trigger EmailRemainder on Opportunity (after update)
{
Set<Id> ids=trigger.newmap.keySet();
Set<Id> idd=new Set<Id>();
List <OpportunityContactRole> ocr;
List<Contact> c;
List <Opportunity>op;
op=[select EmailRemainder__c from Opportunity where OpportunityId IN : ids];
ocr=[Select ContactId From OpportunityContactRole where OpportunityId IN : ids ];
for(OpportunityContactRole r:ocr)
{
idd.add(r.ContactId);
}
c=[select npe01__WorkEmail__c from Contact where ID IN : idd ];
for(Opportunity ops:op)
{
for(Contact ci : c)
{
ops.EmailRemainder__c = ci.npe01__WorkEmail__c;
}
update ops;
}
}
Thanks in advance
Just create a list and add the ops in the list within loop and outside loop use the list to perform DML.
Hope it helps.
All Answers
Just create a list and add the ops in the list within loop and outside loop use the list to perform DML.
Hope it helps.
Hi ,
I have modifed the code,try the below one :-
Hi vinit.
Thanks for the reply .
Kindly take a look at it. http://boards.developerforce.com/t5/Apex-Code-Development/Visualforce-Override-for-Standard-buttons-and-link/td-p/584579