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.
    – SatyaV
    Jun 21, 2019 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, 2019 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/…
    – SatyaV
    Jun 21, 2019 at 16:34

1 Answer 1


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, 2019 at 21:36
  • I eventually used REGEX({!Zip},"\\d{5}(-\\d{4})?")
    – Watson
    Aug 14, 2019 at 19:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .