0

We have a numeric field which should produce a result with decimal points after multiplication in workflow field update.

We are using two fields(one formula, one numeric) for multiplication in formula, both round down to two decimal places.

However, the decimal part is not coming correctly after field update. All fields in the formula have 2 decimal places in their setup.

Field 1 : Margin_per_ton__c : formula field ( Net_Price_per_ton__c - Delivered_Cost_per_ton__c ) upto two decimal places.

Field 2 : Quantity : Number (10,2)

For eg : -

  • Margin_per_ton__c = 115.51 ,
  • quantity = 250
  • Value from Workflow field update = 28,878.25
  • Actual calculation = 28,877.5
1

No matter how many decimal points you choose to show in a formula or number field, Salesforce internally calculates and tracks high precision (I believe 18 points after the decimal). Even if your formula is set to 2 places, it is internally calculated at a much higher resolution; the setting affects only how many decimals are shown in the UI/Reports/API. Based on what you've said, it looks like the internal value for the formula is approximately 115.513, which would appear as 115.51 on the record. If you want the calculations to match, use ROUND in your formula field (labelled Field 1 in your question), or use the ROUND function in your workflow field update to round both values to match the display values (e.g. ROUND(ROUND(Margin_Per_Ton,2)*ROUND(Quantity,2),2)). This may introduce some inconsistencies depending on the actual expected values, though; this is a natural problem of rounding.

1
  • Thanks @sfdcfox. working perfectly – Annappa Feb 17 at 5:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.