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
sankumsankum 

Trigger Help

hi have one scenario

one field has one value (ex:f1=15)

if i upadated that field that field it will replace to f1=50;

 i tried a code but i got some exception what is the code for that?

Best Answer chosen by Admin (Salesforce Developers) 
Vinit_KumarVinit_Kumar

Hi ,

 

Try below :

 

Trigger updateValue on Account(before insert,before update){

 

for(Account acc : Trigger.new){

if(acc.f1__c==15){ //f1__c is the field where value needs to be replaced

acc.f1__c = 50;

}

 

}

All Answers

Tejpal KumawatTejpal Kumawat

Hi kirasan

 

Please can you post exception?

Vinit_KumarVinit_Kumar

Hi ,

 

Try below :

 

Trigger updateValue on Account(before insert,before update){

 

for(Account acc : Trigger.new){

if(acc.f1__c==15){ //f1__c is the field where value needs to be replaced

acc.f1__c = 50;

}

 

}

This was selected as the best answer
sankumsankum
thanks -- Thanks&Regards KIRAN