When using the standard Start Sync button on a quote and having many decimal places in the discount, the Unit Price seems to change on the related Opportunity Line Item (OLI) attempting to be created.
We block (with a validation rule) users from updating Quote Line Items as the values/insertion of them come from our Quoting system which is the source for this. If the OLI is changing on
Start Sync, the
start sync fails.
It seems specific to situations that have discounts/price with many decimal places.
Quote Line Item
- Unit Price = 133.33
- Discount = 9.99775
- Total Price = 119.99999992
- Quantity is 1
- Unit Price is Currency(16,2)
- Discount is Percent(3,2)
- Total Price is Currency(16,2)
- Price book's list price is 0.00 on product
- We have multiple currencies, but the opportunity in question is in USD (our corporate currency).
- USD conversion rate is 1.000000 and set to 2 decimal places.
Ignoring the obvious to not allow these decimal places to come, I'd like to understand the behavior here.
I added a QuoteLineItem trigger to see what was trying to change and what seems to be occurring is the following:
- Unit Price on the OLI is changing to 133.3300001
- Total Price on the OLI is to 119.99999993
This, in turn, is syncing back to the Quote Line Item and hitting our validation rule. The other fields seem to be exact. Below is an image of the exact debug statement.
We have no automation on OLI or Quote Line Items.
My expectation would be that the "Start Sync" would simply copy over the Quote Line Item (as is). Even if it does "recalculate" the total price potentially as mentioned here, I'm not sure how they ended up with those numbers since 9.99775% off 133.33 = 120.0269925. Even trying to cut off certain decimals, I can't find the math that explains it.
I did find documentation regarding OLIs for the following:
If you specify Discount without specifying TotalPrice, the TotalPrice is adjusted to accommodate the new Discount value, and the UnitPrice is held constant.
If you specify both Discount and Quantity, you must also specify either TotalPrice or UnitPrice so the system knows which one to automatically adjust.
However, I'm not sure if the above is coming into play (one being automatically adjusted) as it's the "start sync" button vs. anything I'm in control over. The documentation on How Quote Syncing Works doesn't really explain anything other than to say changes on one affect the other.
Is there any documentation or explanation for why "Start Sync" would be changing the values of the Quote Line Item on first sync?