You need to sign in to do that
Don't have an account?
How can use set methods in this trigger?
How can use set methods in this trigger?
trigger Inventorybid on bid__c (after update) {
List<id> accIds=new List<id>();
double sumTotal = 0;
List<servoTerra_Order__c> OrderUpdate = new List<servoTerra_Order__c>();
for (bid__c bidoffer : Trigger.new){
for (servoTerra_Order__c ord : [select Id, Name, total__c from servoTerra_Order__c where Id=:bidoffer.Order__c])
{
//Sum all the Total offer
for (bid__c bidtotal: [select Id,name,Total_Offer__c from bid__c where Order__c =:ord.id])
{
sumTotal += bidtotal.Total_Offer__c;
}
ord.total__c = sumTotal;
OrderUpdate.add(ord);
}
}
upsert OrderUpdate;
}
Update failed. First exception on row 0 with id a0TV00000003akPMAQ; first error:
CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Inventorybid: execution of
AfterUpdate caused by: System.ListException: Duplicate id in list:
a0UV0000000qI8nMAE Trigger.Inventorybid: line 33, column 1: []