Loading

Salesforce: Field Values Containing Commas Are Truncated When Setting Default Field Values via Custom Buttons

Udgivelsesdato: Nov 12, 2025
Beskrivelse

When you create Salesforce custom buttons or links that pass default field values to a record create page, currency or number fields that contain commas are not parsed correctly as URL parameters. This results in values being truncated after the first comma.

For example, if a number field contains "1,234,500", only "1" is copied, and the values after the comma are lost.

To resolve this issue, you must encode the field value using the TEXT and URLENCODE functions.

Løsning

This article answers the question of why number or currency values with commas are cut off when a Salesforce custom button passes default field values, and how to fix it. When you pass a number field as a default field value in a custom button URL, use the URLENCODE and TEXT functions if the value contains commas. This prevents the comma from being misinterpreted as a URL special character (delimiter) and ensures that the entire value, including everything after the comma, is copied correctly.

Example: Custom Button Setup on the Account Object

The following example shows a URL for a custom button that creates a new Account record from an existing one. It passes the value of a number field (for example, Number_Field__c) from the existing Account to the same field on the new record as a default value.

/lightning/o/Account/new?defaultFieldValues=Number_Field__c={!URLENCODE(TEXT(Account.Number_Field__c))}

In this URL, the TEXT function converts the number to text, and the URLENCODE function encodes special characters such as commas so that they are passed as part of the value. By wrapping the field with TEXT and URLENCODE as shown above, even if the value of Number_Field__c contains commas (for example, "1,234,500"), the entire value is correctly populated in the new record's field.

Scope of Support for Buttons and Formulas

Note: Support for buttons and formulas is limited. For more details, refer to the "Scope of Support for Buttons" and "Scope of Salesforce Support for Formulas" articles listed in Additional Resources.

Vidensartikelnummer

005227057

 
Indlæser
Salesforce Help | Article