+ 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;
}