You need to sign in to do that
Don't have an account?
kezia dola
Trigger to get quote line items in order products
Hi All,
I have two objects called Quote Line Items and Order Products. Using trigger I want to update the order products when quote line items are edited.
Any Idea how to do?
Thanks,
Kezia
I have two objects called Quote Line Items and Order Products. Using trigger I want to update the order products when quote line items are edited.
Any Idea how to do?
Thanks,
Kezia
Is there any relation between these two objects. If so which is the parent and which object is the child. Can you please let community know more information about it.
Thanks
Hi Kezia,
Please try below code to update Product object from the trigger of quote line items.
select Best :) if it helps
trigger TriggerUpdateproductsfromQLItem on QuoteLineItem (after update) {
if(Trigger.isAfter && Trigger.isUpdate){
List<Product2> pList = new List<Product2>();
for(QuoteLineItem quoteitem : trigger.new){
Product2 getproduct = [select Id,Name,Description FROM Product2 WHERE Id=:quoteitem.Product2Id];
getproduct.Description = 'update from trigger';
pList.add(getproduct);
}
if(pList.size() > 0){
update pList;
}
}
}
Thanks
Both the objects have lookup relationship. I am trying get the quote line items in order products object.
Thanks
I have tried below code, but order products are not created when quote line items are created or edited. Quote line Item and Order Product objects have lookup relationship.
trigger TriggerUpdateproductsfromQLItem on QuoteLineItem (after update) {
if(Trigger.isAfter && Trigger.isUpdate){
List<Product2> pList = new List<Product2>();
for(QuoteLineItem quoteitem : trigger.new){
Product2 getproduct = [select Id,Name,Description FROM Product2 WHERE Id=:quoteitem.Product2Id];
getproduct.Description = 'update from trigger';
pList.add(getproduct);
}
if(pList.size() > 0){
update pList;
}
}
}
Any Idea to do this?
Thanks