function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
rwilcox@thinkingphones.comrwilcox@thinkingphones.com 

APEX trigger to update stage based on another field

We are using the Campaigner Playbook plugin to help manage our sales process. The Playbook allows you to create your own Opportunity "Phases" (LSProcessBldApp__Current_Phase__c) which are used to drive a custom process. In our example, these phases map directly to our standard Opportunity Stages.

 

I'd like to create a trigger that will update the standard Stage object in Salesforce to match that of my Opportunity Phase that is defined in Playbook. Any time the record is created/updated, the Stage should be updated with the value that is stored in the Phase custom field.

 

Any help would be greatly appreciated.

ForcepowerForcepower
Are you looking to update Opportunity.Stage with Opportunity.Phase__c whenever an Opportunity is updated?
Rahul_sgRahul_sg
If both fields are on the opportunity object then try creating a Workflow with field update as WF action .
https://login.salesforce.com/help/doc/en/workflow_examples.htm
rwilcox@thinkingphones.comrwilcox@thinkingphones.com

Yes, that's correct Ram.

rwilcox@thinkingphones.comrwilcox@thinkingphones.com

@ Rahul... 

 

One of them is a custom field added by the plugin, so both fields are not on the Opportunity object.