+ Start a Discussion
sonisha ssonisha s 

Can you tell me whats wrong in here,and how can i make this work!

trigger EmptyCS on Account(before insert,before update){
for(CustomObj__c obj: CustomObj__c.getAll().Values()){
for(Account a: Trigger.new){
a.put(obj.Name,'');
update a;
}
}
}


Where CustomObj__c is my custom setting object, i need to set the values of the custom setting to blank, can anyone please suggest a solution!

Thanks & Regards

karthikeyan perumalkarthikeyan perumal
Hello,

Try below code, 
 
trigger EmptyCS on Account (before insert) {
    
List<Account> ObjAcc= new List<Account>();

for(CustomObj__c obj: CustomObj__c .getAll().values()){
for(Account a: Trigger.new){
 a.Name=obj.Name__c;   
ObjAcc.add(a);

}
update ObjAcc;
    
}
}

Hope this will helps you. 

Thanks
karthik