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
prasad p 18prasad p 18 

how to update the fields of the record in object by using apex?give me some examples?

Devi ChandrikaDevi Chandrika (Salesforce Developers) 
Hi Prasad,
You can update a record simply as below
1)fetch the record  with all the fields you want to update by using query
2)give new value to the field by accessing from query result
3)perform Update DML on the record
account acc = [select id,name,description from account where id = '0012v00002lAiyjAAC'];
acc.description = 'updated';//give new value
update acc;

Please refer below link which might help you further
https://www.sfdc99.com/2013/10/13/creating-updating-and-deleting-records/

​​​​​​​Hope this helps you
If this helps kindly mark it as solved so that it may help others in future.

Thanks and Regards