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

Auto update the Opportunity Stage field when a Contract's Status field changes to Activated
Hi all
I thought I could achieve this with a workflow and field update but no :-( From research it looks like the only choice maybe a trigger? Anyones advice would be appreciated.
This is what I'm trying to do:
An approval process has been setup for Contracts and we only allow one contract to be created per Opportunity. When a Contract is approved in the Approval Process and and the Contract 'Status' pick list field is changed to 'Activated' then I want the 'Stage' pick-list field in that Opportunity to be auto updated/changed to 'Closed Won'.
Almost forgot, the Opportunity Stage value will be 'Closed Won Pending Approval' when the Contract is approved, just in case yuo may be wondering why the Oppotunuty Stage isn't already set at 'Closed Won'
Any ideas? Is a trigger the only way?
Thanks
I'd imagine a trigger would look like this:
Does this look like what you're looking for?
All Answers
Correct. Workflow rules only work on the "current" object, so you can't go off and update some other object with workflow. The trigger isn't so bad; it should consist of less than 10 lines of code. I don't think you'll find any other way to go about this.
Thanks sfdcfox
I thought that might be the case.
Does anyone have an example of a trigger written for this purpose?
It sounds like it might be a fairly common request (auto updating a field from Contract to Opportunity?)
The trigger would need to update the standard Stage pick-list field in the Opportunity object to 'Closed Won', regadless of it''s current value, when the Contract created on that Opportunity is approved and the stadard 'Status' pick-list field on that Contract is changed to 'Activated'.
Any help would be appreciated.
Thanks
I'd imagine a trigger would look like this:
Does this look like what you're looking for?
Thanks sfdcfox. Much appreciated. Will try this in the sandbox. Cheers
Why the nested for loops on the opportunity ids?