Hello I'm trying to add Number type input field in flow screen component as Zipcode. I would like to set it to max 5 number long.

I have added input validation formula to Len(Zip)<6

but when i save flow i get error message

Zip (Screen Component) - The formula expression is invalid: Incorrect parameter type for function 'Len()'. Expected Text, received Number

can anyone help me here?

  • You just need to change the field: Zip's datatype to Text, instead of Number.
    – Arnold Jr.
    Jun 21 '19 at 16:24
  • Hi @ArnoldJr. I could certainly do that, but then I need validation for number only, as text field would allow alphabets too.
    – Watson
    Jun 21 '19 at 16:25
  • In that validation, you could have condition to make sure you have only numbers entered for the field: Zip. Something like this: NOT(ISNUMBER(Zip)). I haven't tested this, but you could also try from this solution: salesforce.stackexchange.com/questions/177833/…
    – Arnold Jr.
    Jun 21 '19 at 16:34

Thank you everyone, I have created Text field for Zipcode with validation OR (ISNUMBER(ZIPCODE) && (LEN(ZIPCODE) < 6)) and it worked fine.

  • 1
    you need to consider user entering a value like 2 -- do you assume this is zip code 00002 or an error?
    – cropredy
    Jun 24 '19 at 21:36
  • I eventually used REGEX({!Zip},"\\d{5}(-\\d{4})?")
    – Watson
    Aug 14 '19 at 19:32

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.