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
salesforce@14salesforce@14 

How to write apex code to remove the values from the fields which is already associated in it.

Hi,

             I have value already in my Email field and i want to delete the value from that field once i click on submit button.

Thanks in advance.
 
suresh dupadasuresh dupada

in submit action method 

take that email field and assign blank value the update that email field
Eg., Consider contact has email field, I am fetching record based on some logic, then when i click on submit button then action should perform, in that action method I am assigning blank value to that email filed and then updating that contact.. as a result email value is removed.. 

contact con=[select id,name,email from contact where id=:'xxxxxxxxx'];

submit()
{
      con.email='';
      update con;
}