You need to sign in to do that
Don't have an account?
Chrissy Thompson 12
Apex Trigger to Update Custom field based on Current Date?
We have a field for Q1 Stage, Q2 Stage, Q3 Stage, Q4 Stage. We need someone (Apex Trigger?) to input the Opportunity Stage as soon as Q1 begins, Q2, etc. Once populated, keep as is even if the stage changes throughout that quarter. This should fire regardless if it's edited (just in case an Opportunity sits in the same stage for several quarters and no edits are made). Originally, we were going to use a Process Builder, but this will not account on date without an edit being made. We need the system to know it's the beginning of a quarter, please add the current Opp Status to field. Any suggestions?
Example:
Q1 Stage = Prospect
Q2 Stage = Proposal
Example:
Q1 Stage = Prospect
Q2 Stage = Proposal
I think you can go for schedule apex batch which runs every 1st of 3 months (https://salesforce.stackexchange.com/questions/65248/run-apex-scheduler-quarterly)
Then in the batch start(), query all opportunities and execute the (Q1 Stage = Prospect
Q2 Stage = Proposal) logic.