Useful Default Field Value Formulas
How to apply default field values based on maximum discount rate, product language, or tax rate by city.
Required Editions
| Available in: both Salesforce Classic and Lightning Experience |
| Available in: Contact Manager, Group, Professional, Enterprise, Performance, Unlimited, and Developer Editions |
| User Permissions Needed | |
|---|---|
| To view default field values: | View Setup and Configuration |
| To define or change default field values: | Customize Application |
Maximum Discount Rate
Your organization applies different discount rates to opportunities based on the department of the person creating the opportunity. Use this example to set a default value for a custom field called Discount Rate on opportunities.
CASE(User.Department, "IT", 0.25, "Field", 0.15, 0)In this example, the formula inserts a discount rate of 25% on any opportunity created by a user in the IT department or 15% on any opportunity created by someone in the Field department. A zero is applied if the creator doesn't belong to either of these departments. This field is a custom percent field on opportunities that uses the standard user field Department.
Product Language
You could associate a product with its language so that your users know the type of documentation or adapter to include. Use this default value formula to automatically set the language of a product based on the country of the user creating the product. In this example, the default value is Japanese if the user's country is Japan and English if the user's country is US. If neither is true, the default value unknown is inserted into the Product Language field.
CASE($User.Country , "Japan", "Japanese", "US", "English","unknown")Tax Rate
Use this default value formula to set the tax rate of an asset based on the user's city. Create a custom percent field with this default value.
IF($User.City = "Napa", 0.0750,
IF($User.City = "Paso Robles", 0.0725,
IF($User.City = "Sutter Creek", 0.0725,
IF($User.City = "Los Olivos", 0.0750,
IF($User.City = "Livermore", 0.0875, null
)
)
)
)
)In this example, a tax rate of 8.75% is applied to an asset when the user's address is in the city of Livermore. When none of the cities listed applies, the Tax Rate field is empty. You can also use the Tax Rate field in formulas to automatically calculate taxable amounts and final sales prices.

