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
Rick RossiRick Rossi 

Trigger to clear value

Hi all!

What would a trigger be to clear a value in a formula field if a new value in a different field is populated? I have two email fields "New email"  and "Temp email" once the new email field is populated than the "Temp Email" field should be blank.

Any help would be great!
Suraj Tripathi 47Suraj Tripathi 47
Hi Rick Rossi,

Yes, you can clear the value of Field when certain condition matched, So for the clear value, you will use a trigger like this :
trigger ClearField_Account on Account (before update) {
for(Account acc: trigger.new){
 if(acc.Name = 'Rossi'){
    acc.phone = null ; 
    acc.Discount__c = null ;
        }
    }  
}

You can use a standard field or custom field of Object for update.
---------------
If you find your Solution then mark this as the best answer to close this question. 

Thank you!
Regards,
Suraj Tripathi