You need to sign in to do that
Don't have an account?
Sushma R Iyer
Apex trigger trg_QuoteLineItem has caused an unexpected exception. Contact your administrator: trg_QuoteLineItem: execution of AfterInsert caused by: System.ListException: Duplicate id in list: 0QL1E000004rJkSWAU: ()
Hi All,
When a user is trying to create a Quote for an Opportunity then the below Error is displayed :
Apex trigger trg_QuoteLineItem has caused an unexpected exception. Contact your administrator: trg_QuoteLineItem: execution of AfterInsert caused by: System.ListException: Duplicate id in list: 0QL1E000004rJkSWAU: ()
Also since this code is not developed by me , I am unable to understand on whats causing the issue in the below Code :
Please Help...Thanks for All Help in Advance
When a user is trying to create a Quote for an Opportunity then the below Error is displayed :
Apex trigger trg_QuoteLineItem has caused an unexpected exception. Contact your administrator: trg_QuoteLineItem: execution of AfterInsert caused by: System.ListException: Duplicate id in list: 0QL1E000004rJkSWAU: ()
Also since this code is not developed by me , I am unable to understand on whats causing the issue in the below Code :
trigger trg_QuoteLineItem on QuoteLineItem ( after insert, after update, after delete, before insert, before update ) { cls_trg_QuoteLineItem handler = new cls_trg_QuoteLineItem(); if (trigger.isafter && trigger.isInsert) { system.debug('inside after insert'); handler.removeWarrantyFromQuote( trigger.new ); } if ( trigger.isAfter ) { if ( trigger.isInsert || trigger.isUpdate ) { //Set Quote's 'QLI Rebate Names' and 'QLI_Conga_Template_ID_s_c' Process handler.updateQuoteFromQLIInsert(trigger.new); handler.updatePromotionListPrice(trigger.new); } if ( trigger.isDelete ){ //Set Quote's 'QLI Rebate Names' and 'QLI_Conga_Template_ID_s_c' Process handler.updateQuoteFromQLIInsert(trigger.old); } } else if(trigger.Isbefore) { //handler.updatePromotionListPrice(trigger.new); } }
Please Help...Thanks for All Help in Advance
Probably somewhere in the "cls_trg_QuoteLineItem" Class(The handler class, you provided the trigger class) The same Id/Record is entered Into a List that been Updated twice - Thats the Error...
Usally this can be solved by using Set or Map instead of List
In order to help you a bit more please add the handler class.
Roi.
PFB the requested :
The Error happens becuase on Line :
067 - updateQuoteLineItemList.add(qLI);
You are entering to the update list the same qLI more than one time.
It also probably means you are calculating wrong this :
qLI.Promotion_List_Price__c = (qLI.ListPrice != NULL && qLI.ListPrice >= 0) ? qLI.ListPrice + pro.Promotional_Price__c :
pro.Promotional_Price__c;
qLI.Modifier_ID__c = pro.Oracle_Modifier_ID__c;
First you should remove the updateQuoteLineItemList.add(qLI); outside of the inner loop.
seconed you should check whats the buisness requirment if more than one Promotion_Product__c fits the conditions i can only guess that
qLI.Promotion_List_Price__c should be += instead of =.
Good Luck.
Thanks a lot! Will check and let you know.