You need to sign in to do that
Don't have an account?
Kavita
Help with writing a trigger to update field
How do I write a trigger for the opportunity product object that updates the "sales price" field every time the "discount field" or the "Qty" field is changed?
Please help.
really?
you're not even going to try?
ok, here's a little help:
for(OpportunityLineItem oli : Trigger.new){
OpportunityLineItem oldoli = System.Trigger.oldmap.get(oli.Id);
if(oli.Quantity != oldoli.Quantity){
// oli.UnitPrice = something;
}
}
before update *only*.
"why?" you ask...I'll leave that to you as an exercise.
All Answers
really?
you're not even going to try?
ok, here's a little help:
for(OpportunityLineItem oli : Trigger.new){
OpportunityLineItem oldoli = System.Trigger.oldmap.get(oli.Id);
if(oli.Quantity != oldoli.Quantity){
// oli.UnitPrice = something;
}
}
before update *only*.
"why?" you ask...I'll leave that to you as an exercise.