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
kirankumarreddy punurukirankumarreddy punuru 

Can someone tell me the meaning of this two lines

if(tasksToUpdate.size() > 0 && calledFrom == 'batch')

tasksToupdate is the list and remaining part i did not understood help me 

if(tasksToUpdate.size() > 0 && calledFrom == 'batch')
  1. It is if condition and checking that the list "tasksToUpdate"in which reocrd are maintained is empty or not. If the size of List is greater than Zero than it return True.
  2. calledFrom --> It is String type property in your class and it the value in the property is batch then it return true.

If ! and 2 are true than all contition will be true and then next statment will be execute.


Database is system class define by Salesforce and Update is function which take the list of record and update the record which are in present in "tasksToUpdate" list.

Ashlekh Gera
kirankumarreddy punurukirankumarreddy punuru
Thanks Ashlekh Gera ,
                               I am having one doubt that is how to cover test coverage for :
                                catch(DmlException ex){
                                 return null;
Vishal Negandhi 16Vishal Negandhi 16
For such exceptions, we can skip coverage. I mean why would you throw an exception inside your test code. 
However, here's a good example if you want to cover these lines too.