• Anant Kumar Dev
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
hi Friends in this trigger "Variable does not exist: list at line 53 column 9" error is showing.please help with this. and another thing if i want to fetch the date from createdBy field then what will be the syntax for SOQL & if i want to fetch picklist into a text field then what will be thye soql syntax.



trigger RevenueWithoutST on Revenue__c (after insert, before update) {
    List<SCSCHAMPS__Appointment__c> appList;
    List<Revenue__c> revlist;
    Revenue__c r= new Revenue__c();
    string eCode;
    date salaryDate;
    string category;
    string type;
    for(Revenue__c rev:Trigger.new)
    {
        eCode=rev.ECode__c;
        salaryDate=rev.Salary_Processed_Month__c;
        category=rev.InvoiceCategory__c;
        type=rev.Invoice_Type__c;
        
        if(eCode!=null)
        {
           appList =[select AvvasECode__c,Name_of_the_Candidate__c,Client_Name__c,Date_of_Onboarding__c,
                    Last_Working_Date__c,Location__c from SCSCHAMPS__Appointment__c where AvvasECode__c=: rev.ECode__c] ;
            
            for(SCSCHAMPS__Appointment__c app : appList)
            {
                r.Talent_Name__c= app.Name_of_the_Candidate__c;
                
            }
            
        }
        if(eCode!=null && category=='individual' && salaryDate!=null && type=='Time& Material' )
        {
            List<Invoice__c> InvList;
            Invoice__c inv= new Invoice__c();
            InvList=[select id,Name,Emp_Code__c,Invoice_Category__c,
                     Sub_Total__c from Invoice__c where Emp_Code__c=: rev.ECode__c
                       ];
                FOR(Invoice__c inc : InvList)
                {
                    r.Revenue_Without_ST__c=inc.Sub_Total__c;
                }
                
        }
        else if(eCode!=null && category=='consolidated')
        {
            List<Invoice_Line_Item__c> ILineList;
            Invoice_Line_Item__c iline=new Invoice_Line_Item__c();
            ILineList=[select id,Name,Employee_Code__c,Total__c
                       from Invoice_Line_Item__c where Employee_Code__c=:rev.ECode__c ];
            for(Invoice_Line_Item__c IL : ILineList)
            {
              r.Revenue_Without_ST__c=IL.Total__c;  
            }
        }
        
        list.add(rev);
        
        
    }
    update revlist;

}