You need to sign in to do that
Don't have an account?
Masie Maseli
Update field from product to quote line item entry screen
I have a field on the product that I would like visible as quote line items are entered. Can someone please tell me what is wrong with my code below?
trigger UpdateFormulaFields on QuoteLineItem (before insert,before update) { set<id> PIds = new set<id>(); for(QuoteLineItem qli : Trigger.new){ PIds.add(qli.Product2Id); } list<Product2> pList = [select id, name , Cost_Price__c, Quantity_On_Hand__c, In_Stock_Pricing__c from Product2 where Id IN : PIds]; for(Product2 p : pList){ for(QuoteLineItem ql : Trigger.new){ if(p.id == ql.product2Id){ if(Trigger.isInsert){ ql.Cost_Price__c = p.Cost_Price__c; ql.Quantity_On_Hand__c = p.Quantity_On_Hand__c; ql.In_Stock_Price2__c = p.In_Stock_Pricing__c; } if(Trigger.isUpdate){ ql.Cost_Price__c = p.Cost_Price__c; ql.Quantity_On_Hand__c = p.Quantity_On_Hand__c; ql.In_Stock_Price2__c = p.In_Stock_Pricing__c; } } } } update pList; }
I assume you want the field values from product sould be displayed on quote line items.
if yes, try below code
Mark this as "SOLVED" if your issue is resolved