You need to sign in to do that
Don't have an account?
kailash ambekar
trigger on Opportunity to update custom object field
i'm new to Trigger. i want to write trigger on Opportnuity .
Opportunity Standard field :CloseDate
Custom Field :Status(Status_c) (picklist)
Custom Object :Customer(Customer__c)
custom field : Contract End Date(Contract_End_Date)
when Opportunity status field is updated to Accepted, then customer contract end date field should be updated to close date . there is master detail relationship. i have tried to code.
Opportunity Standard field :CloseDate
Custom Field :Status(Status_c) (picklist)
Custom Object :Customer(Customer__c)
custom field : Contract End Date(Contract_End_Date)
when Opportunity status field is updated to Accepted, then customer contract end date field should be updated to close date . there is master detail relationship. i have tried to code.
trigger ContractDate on Opportunity ( after update) { List <ID> opps=New List<ID>(); for(Opportunity o:Trigger.new){ if(o.Status__c=='Approved'){ opps.add(o.Id); } } Customer__c customerList=[SELECT Id,Contract_End_Date__c FROM Customer__c WHERE id in:opps]; for(Customer__c cst:customerList){ customerList.Contract_End_Date__c=Opps.CloseDate; update cst; } }
Please post the error you are getting .
Regards
Jay
You can simply use process builder to accumplish you requirement, anyway below trigger will help you.
Please let me know, if it helps you.
BestRegards,
Dayakar.D