You need to sign in to do that
Don't have an account?
Samir Meshram
How to auto closed/won stage after attaching a file in attachments
Hello Evryone,
We have requirement like, whenever we attche a file or document in particular opportunity, that opprtunity stage should be automatically updated to closed/won.
Please help me on this if anybody has any idea about it.
Thanks
We have requirement like, whenever we attche a file or document in particular opportunity, that opprtunity stage should be automatically updated to closed/won.
Please help me on this if anybody has any idea about it.
Thanks
Hi Samir,
We can write a trigger for this.Whenever first time attachment is add to that Opportunity then it become Closed won
is this work for you??
Thank you for your response, yes it will work, but i am not that good at writting trigger or code, can you please share a snippet ot the trigger?
Thanks
Something like this
Please follow below code:-
ContentDocumentLinkTrigger
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh
i have this trigger
trigger FilesTrigger on ContentDocumentLink (after insert, after update) {
List<Opportunity> oppList = new List<Opportunity>();
Set<Id> oppIds = new Set<Id>();
for(ContentDocumentLink cdl : trigger.new) {
if(cdl.linkedentityid.getSobjectType() == Opportunity.SObjectType){
oppIds.add(cdl.linkedentityid);
}
}
oppList = [select id, StageName from Opportunity where id in :oppIds];
if(oppList!=null && oppList.size()>0 ){
for(Opportunity op : oppList){
op.StageName = 'Closed Won';
}
update oppList;
}
}
this was working fine .
But now one more thing is added in scenario, now there is one checkbox named 'Signed', now i want after attching a file only if that checkbox is clicked to true then stage should move to closed/won.
Check box on which object?
this check box should be auto check by code or manually
Please confirm
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
I used above code, but it is not working,O you think the trigger should be on opprtunity.?