i write below trigger on that time this error is appear plz help me
trigger GK_betaObject_trg on GIRI2__betaObject__c(after insert,after delete,after update) {
List<Rollup_Config__c> sfRollup = [Select Id,Parent_Field_Name__c,Parent_Object_Name__c,
Parent_Relation_Name__c,Child_Field_Name__c ,
Child_Object_Name__c ,Operation_Type__c,Filter1__c,Filter2__c,
Filter3__c,Filter4__c,Filter5__c from Rollup_Config__c where Child_Object_Name__c ='GIRI2__betaObject__c' ];
if(sfRollup.size() > 0){
for(Rollup_Config__c conf: sfRollup){
List<Id> pIds = new List<Id>();
List<sobject> dataList = Trigger.IsDelete ? Trigger.old :Trigger.new;
for(sobject rec : dataList){
pIds.add(String.valueOf(rec.get(conf.Parent_Relation_Name__c)));
}
if(pIds!=null && pIds.size() > 0){
System.Debug('pIds : '+pIds);
LookUpConfigBatch batchObj = new LookUpConfigBatch(conf);
batchObj.pIds = pIds;
String batchId = Database.executeBatch(batchObj);
}
}
}
}
Best Answer
Some batch or future process is updating records which is causing this to attempt to execute another batch and you cannot do that.
To Stop the error:
Then rerun all your test methods to ensure it did not stop any business logic from happening. If you do not have good test methods you will need to inspect your code / logic to ensure that all updates are happening as expected.