0

On the Account object I have a field called Postal Zip Code. If Postal Zip Code is more than 5 characters long (e.g. "12345678"), I have to truncate to 5 characters (e.g. "12345"). How can I do so using Validation Rules?

  • 3
    you cannot use validation rule to update field values. it has to be either workflow field update or a process builder. validation rules are used to prevent / stop entering incorrect values. – Vamsi Krishna Mar 6 '17 at 11:16
7

Assuming you want to take the first 5 digits from the zipcode field to use in the validation rule, you can use the LEFT function to do that. As per the Salesforce documentation, the LEFT(text, num_chars) function Returns the specified number of characters from the beginning of a text string.

TRIM(LEFT(zipcode, 5))

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.