Skip to main content The Trailblazer Community will be unavailable from 2/1/2025 to 2/2/2025. Please plan your activities accordingly.
public class op_trigger

{

    public void op_check(List<Opportunity> ops)

        {

            Double Total_Amount = 0 ;

            for(Opportunity o1 : [select amount form Opportunity where CreatedDate = Today AND CreatedByID = :UserInfo.getUserID()])

                                    {

                                        Total_Amount = Total_Amount + o1.Amount;

                                    }

                                    

          for(Opportunity o2 : ops)

          {

              Total_Amount = Total_Amount + o2.Amount;

              

              if(Total_Amount > 1000000)

              o2.addError('out of Limit');

          }                          

        }

}
4 answers
  1. Oct 18, 2016, 7:19 AM
    thnkuuu all
Loading
0/9000