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

Update a field value using apex class


how to update a boolean field value for last record at the time of inserting large number of records?


        Am inserting large number of records in one object using apex class at that time ,i want to ensure a boolean field value as true for last record.





Can you share your code ?

I don't understand your search condition, please give me a detailed description with your problem. I will sent a solve scenario to you. Thanks.

Yoganand GadekarYoganand Gadekar

Sample code as below,(this updates the booleanfield__c as true for last record in accList[Account List])


Integre count = 0;

for(account acc: accList){


if(count == accList.size())

  acc.BooleanField__c = true;