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
Force developer 4Force developer 4 

Make field blank through trigger?

Hi ,

I have a two objects 1.Candidate__c 2.Book__c.

Book is the child object  for Candidate. we can create a book records through candidate related list.

Book is having picklist field i.e "Book_Name__c". Book_name__c having only one value Java but while creating a book record by default None will be displayed for this field.

Now i have created a Book record with Book_Name__c= Java through candidate related list.

My question is :

If i create another book record  with Book_Name__c= Java through candidate related list then i need to make previously created record field Book_Name__c is blank(null)

i need to achieve the above requirement through trigger only. Can you please help me on this?

I don't know coding pls help me!!

Thanks in advance
mahendar mmahendar m

Consider the if condition in a trigger like Book__c.
//user before insert or before update events on 

 if(Book_Name__c='java'){
      // here you take the triggee.old values in to a for loop
        for(book__c bb : trigger.old){
                //here you can modify the old values has per your condition 
}       
}
I hope it helps,
Thank You.