I have the following scenario:
I need to calculate the
UnitPrice of OppLineItem based on a calculation that takes into account other parameters, such as custom fields and formulas created for the OppLineItem.
This calculation will be done via a method that is called on the
onBeforeInsert/Update events of the
Now the curious part of the story is that when I created the corresponding Test method and started executing it, it has failed on every trial . I debugged the code, and in the debug log I was obtaining the desired value on
UnitPrice, nonetheless, in the
System.assert call on my Test, the assertion always fails , and always outputs as the value of UnitPrice, the same value that is assigned to the
PricebookEntry's UnitPrice, the PricebookEntry that corresponds to the Oli I am testing.
I did a little research on the documentation and I found this :
Description for ListPrice of Oli: Corresponds to the UnitPrice on the PricebookEntry that is associated with this line item, which can be in the standard pricebook or a custom pricebook. A client application can use this information to show whether the unit price (or sales price) of the line item differs from the pricebook entry list price.
I didn't found anywhere in the documentation an explicit relation between the UnitPrice of Oli and the Unit Price of its corresponding PBE.
Am I missing something here?
I think that my problem is somehow theoretical , in terms of concepts around the functionality and relations between
OLI. Nonetheless I could also provide the code if needed, let me know!
Thanks a lot.