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
PlainviewPlainview 

Setting probability percentage based on Amount field in Opps.

Our sales forecasts tend to be off because the renewal opportunity probability default is 65%. We'd like to change these defaults to different percentages based on the Opportunity Amount field for Opps in the proposal stage:

65% for Opp. amounts less than $5K
80% for $5k -15k
85% for $15k - 99k
95% for > $100K


We have an apex trigger that deals with our probabilities. Right now, it has some logic for the Closed opps:

//NEW:
    //changed this trigger to only reset the probability on closed won, lost opps.

    Map<String, Integer> closeMap = new Map<String, Integer>();
    closeMap.put('Closed Won', 100); 
    closeMap.put('Closed Lost', 0);
    closeMap.put('Closed Funnel Purge', 0);    
    
    for (Integer i = 0; i < Trigger.new.size(); i++) {
        if (closeMap.containsKey(Trigger.new[i].StageName)) {
            Trigger.new[i].Probability = closeMap.get(Trigger.new[i].StageName);    
        }
    }    

So, I need to build from here. Any suggestions?

Thanks,

Julien

PlainviewPlainview
Trying this in an Apex Class but still not working:

      if (oprt.Type == 'Renewal'){
          if (oprt.StageName == 'Proposal'){
              if (oprt.Amount <= 5000){    
                  oprt.Probability = 65;
              }
          }
      }
      if (oprt.Type == 'Renewal'){
          if (oprt.StageName == 'Proposal'){
              if (oprt.Amount >= 5000){ 
                  } else if (oprt.Amount <= 15000){    
                 oprt.Probability = 80;
              }
          }
      }  
        if (oprt.Type == 'Renewal'){
          if (oprt.StageName == 'Proposal'){
              if (oprt.Amount >= 15000){ 
                  } else if (oprt.Amount <= 100000){    
                  oprt.Probability = 85;
              }
          }
      }
      
    if (oprt.Type == 'Renewal'){
          if (oprt.StageName == 'Proposal'){
              if (oprt.Amount >= 100000){    
                   oprt.Probability = 90;
              }
          }
      }