You need to sign in to do that
Don't have an account?
elosso
Need to use a trigger when a field updates
Here is the trigger I'd like to create:
I have an Opportunity Product with a Actual Impressions field. I use the Quantity to forecast the likely impressions; however, at the end of each month, I go back and populate Actual Impressions. When I change Actual Impressions, I'd like to launch a trigger that update the Quantity field to the value of the Actual Impressions field.
Any help would be appreciated!
My code so far:
trigger updateQuantity on OpportunityLineItem (after update) { for (OpportunityLineItem newQuantity : Trigger.new) { OpportunityLineItem oldQuantity = Trigger.oldMap.get(newQuantity.Id); if (oldQuantity.Actual_Impressions__c != newQuantity.Actual_Impressions__c) { // this is where I don't know how to update a given field } } }
Is the quantity field on the OpportunityLineItem as well? If so you should change the trigger to before update, something like this should do:
All Answers
Is the quantity field on the OpportunityLineItem as well? If so you should change the trigger to before update, something like this should do:
i have a trigger in which i have code like this
where i have a field count which counts when status changes from open to closed , converted to closed but my code even counting whenever status changes from closed to closed which i dont want. please helpout, i am new to this.
if((OPP.Count__c==OPPOLD.Count__c)&&OPP.Status__c=='Closed')