You need to sign in to do that
Don't have an account?

Update Opportunity Field with Product custom Fields
Hi
How to update opportunity field with product custom field (using trigger).
Thanks
Srikanth.
How to update opportunity field with product custom field (using trigger).
Thanks
Srikanth.
Right now the question is so high level its going to be hard to give you direct feedback, but instead just general practice.
Below code may help you in achieving your requirement.
trigger updateopp on Opportunity (after insert, after update)
{
Map<Id,Opportunity> oppIds = new Map<Id,Opportunity>();
List<Opportunity> updateList = new List<Opportunity>();
for(Opportunity op : Trigger.new)
{
oppIds.put(op.id,op);
}
OpportunityLineItem[] OLI = [Select UnitPrice, Quantity, PricebookEntry.Product2Id, TotalPrice,PricebookEntry.Product2.Name, Description,
Converted_to_Asset__c,Asset__c,PricebookEntry.Product2.Create_Asset__c, PricebookEntry.Product2.Sales_Order_Group__c
From OpportunityLineItem
where OpportunityId IN : oppIds.keySet() And PricebookEntry.Product2.Product_Reporting_Category__c = 'Services'];
for(OpportunityLineItem opli : OLI)
{
if(opli.PricebookEntry.Product2.Sales_Order_Group__c = 'Hotline Services' || o.PricebookEntry.Product2.Sales_Order_Group__c = 'Policy Management Services' || o.PricebookEntry.Product2.Sales_Order_Group__c = 'Incident Management Services')
{
Opportunity opp = new Opportunity(id=o.OpportunityId);
opp.Implementation_Team__c = true;
updateList.add(opp);
}
if(o.PricebookEntry.Product2.Sales_Order_Group__c = 'ReadyTraining Services')
{
Opportunity opp = new Opportunity(id=o.OpportunityId);
opp.Training_Team__c = true;
updateList.add(opp);
}
}
if(updateList.size()>0)
{
update updateList;
}
}
As philip said you have to know where update is occuring.
Thanks
Prad
Please let me know if you are still persisting this issue. let me know if any issues.
If your problem solved give kudos to the post.
Regards
Prad