Bulk State TransitionReading Only
You are given two Maps of Opportunities. oldMap
representing the Opportunities before update. newMap
representing the Opportunities after update.
Each map has the Opportunity Id as the key, and the Opportunity object as the value. The maps will never be null or empty.
Implement the method called getOppsWithStageChange(...)
that returns a Set of Opportunity Ids where the StageName has changed between the old and new versions. You can assume this code is called from a Trigger Context and the maps represent Trigger.oldMap
and Trigger.newMap
Example:
Input
oldMap = {
'006aj00000Bt9ngAAB' => Opportunity(Id='006aj00000Bt9ngAAB', StageName='Prospecting'),
'006aj00000Bt8oXAAD' => Opportunity(Id='006aj00000Bt8oXAAD', StageName='Closed Won'),
'006aj00000Bt4loABC' => Opportunity(Id='006aj00000Bt4loABC', StageName='Prospecting')
}
newMap = {
'006aj00000Bt9ngAAB' => Opportunity(Id='006aj00000Bt9ngAAB', StageName='Value Proposition'),
'006aj00000Bt8oXAAD' => Opportunity(Id='006aj00000Bt8oXAAD', StageName='Closed Won'),
'006aj00000Bt4loABC' => Opportunity(Id='006aj00000Bt4loABC', StageName='Closed Lost')
}
Output: A Set of Ids containing 006aj00000Bt9ngAAB
and 006aj00000Bt4loABC
Constraints You should not modify the input maps. Trigger.old
, Trigger.oldMap
, Trigger.new
, Trigger.newMap
are not available in this context.