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
Ashmi PatelAshmi Patel 

unexpected token: Opportunity at line 6 column 53

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');
          }                          
        }

}
Tejas KardileTejas Kardile
*form* Change type to from 
Tejas KardileTejas Kardile
Working code:
public class op_trigger
{
    public void op_check(List<Opportunity> ops)
        {
            Double Total_Amount = 0 ;
            for(Opportunity o1 : [select amount from 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');
          }                          
        }

}
Rowallim TechnologyRowallim Technology
Hi Ashmi
You have written wrong spelling of from in the query correct it.
Hope it will help you.
Please mark it best answer if it helps.
Thanks
Ashmi PatelAshmi Patel
thnkuuu all