You need to sign in to do that
Don't have an account?

Notes And Attachments
Hi All,
If opportunity stage should to close user have to upload a doc for this i wrote a trigger its working good, now issue is if that attachment is deleted ,opportunity stage should be old value what i have to do how i can wrote trigger on notes and attachment help me
Eg,
trigger triggerName on Attachment (after delete) {
List<Opportunity> opps = [Select Id, Stage, Attachment from Opportunity where Id = : Trigger.New[0].ParentId];
if(opps.size() > 0){
for(Opportunity opp : opps){
opp.Stage = 'old value';
update opp;
}
}
}
hope this will help you.
Trigger[0]. id will not work , need to be bulkified
create a list of id & then query with that with In clause
@vijit Capgemini Developer