You need to sign in to do that
Don't have an account?
Raju 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;
}
}
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;
}
}
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]
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