I have a batch class that is used to update a Field1
of Obj1
.
Obj1
is child of Obj11
.
Inorder to update Obj1
, I need to unlock its parent Obj11
first.
[by updating lock__c=false
].
Then update Obj1
.
Then again lock back the Parent Obj11
[by updating lock__c=true
].
Is this a correct way to do so, by using successive update statement inside
void execute(Database.BatchableContext bc, list<sObject> sObj){}
method, like
Update List<Obj11>;
Update List<Obj1>;
Update List<Obj11>;
or I need to place some of these Update statement under
void finish(Database.BatchableContext bc){}
method.
Please advise.