ERROR 1 :
Subject: Developer script exception from Nicomatic : quotepotential : quotepotential: execution of AfterUpdate caused by: System.QueryException: Record Currently Unavailable: The record you are attempting to edit, or one of its related records, is currently being modified by another user. Please try again. Trigger.quotepotential: line 14, column 1
Apex script unhandled trigger exception by user/organization: 00590000001A6jh/00D90000000bovq
quotepotential: execution of AfterUpdate
caused by: System.QueryException: Record Currently Unavailable: The record you are attempting to edit, or one of its related records, is currently being modified by another user. Please try again.
Trigger.quotepotential: line 14, column 1
ERROR 2: same
Subject: Developer script exception from Nicomatic : batchtoquotelineitem : batchtoquotelineitem: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id a0L90000004mgNmEAI; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, quotepotential: execution of AfterUpdate caused by: System.QueryException: Record Currently Unavailable: The record you are attempting to edit, or one of its related records, is currently being modified by another user. Please try again. Trigger.quotepotential: line 14, column 1: [] Trigger.batchtoquotelineitem: line 13, column 1
Apex script unhandled trigger exception by user/organization: 00590000001A6jh/00D90000000bovq
batchtoquotelineitem: execution of AfterUpdate
caused by: System.DmlException: Update failed. First exception on row 0 with id a0L90000004mgNmEAI; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, quotepotential: execution of AfterUpdate
caused by: System.QueryException: Record Currently Unavailable: The record you are attempting to edit, or one of its related records, is currently being modified by another user. Please try again.
Trigger.quotepotential: line 14, column 1: []
Trigger.batchtoquotelineitem: line 13, column 1
can you correct this program to get rid of these two exceptions :
trigger quotepotential on Quote_Line_Item__c (after insert,after update) {
Set<Id> quoteIds = new Set<Id>();
List<Quote__c> quotes = new List<Quote__c>();
for(Quote_Line_Item__c record: Trigger.new) {
if (record.Quote1__c != null){
quoteIds.add(record.Quote1__c);
}
}
for(AggregateResult ar:[SELECT Quote1__c , SUM(Max_Batch__c)sumMax FROM Quote_Line_Item__c WHERE Quote1__c IN :quoteIds GROUP BY Quote1__c]) {
Quote__C qu=new quote__c();
qu.id=(Id)ar.get('Quote1__c');
qu.Potential__c=(Decimal)ar.get('sumMax');
quotes.add(qu);
list<quote__c> quo = [select id,potential__c from quote__c where id IN :quotes limit 1 for update];
update quo;
}
if(quotes.isempty() == false)
{
update quotes;
}
}