Github Link : https://github.com/AourLegacy/AourFactory/tree/ControleDecimals
Salesforce CPQ (Configure, Price, Quote) is a powerful platform that allows businesses to automate and streamline the quoting process. One of the features that users often want to customize is the precision of decimal numbers on prices, especially when dealing with currencies and specific industry requirements. In this article, we will explore a method to control the decimal number on a price in Salesforce CPQ using product rules and custom fields.
The Problem:
In many industries, especially finance and manufacturing, it's crucial to have precise control over decimal places. For instance, a business might want to ensure that no price has more than three decimal places. This could be to meet industry standards, maintain consistency, or simply to prevent errors in the quoting process.
The Solution:
To control the number of decimal places on a price in Salesforce CPQ, we can use a combination of custom fields and product rules.
Step 1: Create a Custom Formula Field on the QuoteLine Object
1. Navigate to the `Setup` area in Salesforce.
2. In the Quick Find box, type "Objects" and select `Objects and Fields` > `Object Manager`. 3. Find and select the `QuoteLine` object.
4. Click on the `Fields & Relationships` link on the left side.
5. Click the `New` button to create a new custom field.
6. Select `Formula` as the field type and click `Next`.
7. Name the field something descriptive, like "Decimal Checker".
8. For the formula return type, select `Checkbox`.
9. In the formula area, enter a formula that checks if the decimal number of the price is more than three.
For example:
This formula checks the length of characters after the decimal point of the price. If it's more than three, it returns `TRUE`, otherwise it returns `FALSE`.
10. Save the field.
Step 2: Create a Product Rule to Block the Price :
1. Navigate to the Salesforce CPQ app.
2. Go to the `Product Rules` tab and click `New`.
3. Enter a descriptive name for the rule, like "Block Excessive Decimals".
4. For the `Scope`, choose `Quote Line`.
5. For the `Conditions Met` field, select `All`.
6. Click `Save`.
7. In the conditions related list, create a new condition that checks if the "Decimal Checker" field is `TRUE`.
8. Set the type of action to `Error` and provide a meaningful error message like "Prices cannot have more than three decimal places."
Step 3: Test the Product Rule :
1. Create a new quote or use an existing one.
2. Add a product with a price that has more than three decimal places.
3. Try to save the quote. You should see the error message indicating that the price cannot have more than three decimal places.
Controlling decimal precision in Salesforce CPQ is essential for many businesses. With the combination of custom fields and product rules, businesses can ensure accuracy and consistency in their quoting process. This method offers a flexible and straightforward way to meet industry standards and prevent potential errors.
Comments