Skip to main content
1 of 3

Not able to access TotalPrice in OrderItem

Trying to write trigger on Order item .I have created new field called discount.I have to perform formula using trigger on TotalPrice(TotalPrice=Discount*TotalPrice).I am not able to access TotalPrice hence getting this error "Innvalid field TotalPrice for SObject OrderItem " Not understanding how to access TotalPrice fields .

trigger Totalprice on OrderItem (after insert,after update) { if(trigger.isafter && trigger.isupdate){ for(OrderItem oi : trigger.new) { Oi.TotalPrice= Oi.Discount__c*Oi.TotalPrice; } } }