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
thrinadh raothrinadh rao 

Write a trigger on compitator accounts

I am getting error code for the this code. Can anyone help me .

Error: Compile Error: Variable does not exist: Compitator_picklist__c at line 4 column 80

trigger GetCompitator on Account (after insert) {
Account Acc=[SELECT id,Name,Compitator_picklist__c From Account];
    List<Account> AccList = new List<Account>();
    Compitator__c Comp =[SELECT id,Name From Compitator__c Where Name=:AccList.Compitator_picklist__c];
    for (Account Acc : trigger.new){
         Acc.Compitator__c = Comp.Name ;
    }
}
 
Raj VakatiRaj Vakati
Use this code and bulky

 
trigger GetCompitator on Account (before  insert) {
	
    for (Account Acc : trigger.new){
		Compitator__c Comp =[SELECT id,Name From Compitator__c Where Name=:Acc.Compitator_picklist__c Limit 1 ];

         Acc.Compitator__c = Comp.Id ;
    }

}