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
Raju I 5Raju I 5 

Compile Error: expecting a semi-colon, found 'for' at line 10 column 19. i want compare diffrent object if compare true fallow the step

Hi help me out
trigger  test on Account (before insert, before update,after insert)
{  
List<Customer_Info_Form__c> lst = new List<Customer_Info_Form__c>();
        for(Account acc : trigger.new){
        
             list<Customer_Info_Form__c> con= [ select  Contact_Number__c,Email__c, Customer_Account__r.Name from  Customer_Info_Form__c where
  id in:trigger.new]
                   //Customer_Info_Form__c con = new Customer_Info_Form__c();
                   
                   for(Customer_Info_Form__c c1 : con)
                   {
                        if(Customer_Account__r.Name== acc.Name )
                         {
     
                       c1.Contact_Number__c = acc.PersonMobilePhone;
                       
                         c1.Email__c = acc.CG_Email_ID__c;
                     }
                        con.add(lst) ;
                       
            
        update  lst;
       
      
       }
       }
3 Creeks3 Creeks
Looks like you are mssing the semi colon at the end of this line:

 list<Customer_Info_Form__c> con= [ select  Contact_Number__c,Email__c, Customer_Account__r.Name from  Customer_Info_Form__c where
  id in:trigger.new]
3 Creeks3 Creeks
Trigger.new is a Map.   To use "WHERE id IN" in your query you need to have a List or Set of Ids.
Raju I 5Raju I 5
sir list con= [ select Contact_Number__c,Email__c, Customer_Account__r.Name from Customer_Info_Form__c where id IN:acc.id]; i am getting same error Compile Error: IN operator must be used with an iterable expression at line 7 column 48
3 Creeks3 Creeks
Ok...there a couple problems here.

First, acc.Id is not a List either, it is one id.   So if you are going to use acc.id then the where clause would simply be: WHERE id = :acc.id

Second, your trigger has a query in a loop which is a big no-no.  You should read this best practices: https://developer.salesforce.com/page/Apex_Code_Best_Practices  specially best practice #2 Avoid SOQL Queries or DML statements inside FOR Loops

 
Raju I 5Raju I 5
hi i am trying update Bike Regno: which is look up.to meeting form, i am not able to update in lookup field in same object public class CS_CIF_Trigger_Handler { list custominfo =[select id from Customer_Info_Form__c]; for(Customer_Info_Form__c c: custominfo) { assset a= new asset(); //a.Asset__r.CG_Reg_No__c = c.Bike_Reg_No__c; a.CG_Reg_No__c = c.Bike_Reg_No__c; } update custominfo; }