Phone number validation

Hi,

Is there a way to validate a record field as being an actual phone number. If I could validate a string as being exactly 10 digits that would be enough for now. But even in the CRM app it is possible to enter alphabetic characters in a phone number field.

I actually think that a Phone Number field type would be beneficial. Forcing E.164 format with a default country code able to be set. Control of the display format would be even better.

Thanks

1 Like

You can use field value validation (configured in the LowCode admin panel > modules > module field configuration). Here is the function reference you can use to validate the values.

For extreme cases, where you need a lot more processing to validate something, you can use an automation

I’ll open up a ticket to discuss how/when we would add support for the new field as I also see a benefit in having it there.

Thanks for your prompt response, and for the amazing software you are developing and releasing. I have looked into a number of low code platforms, and while young, Corteza shows more promise than any of the others I have touched.

I have looked through the function docs. I saw that there was a length function, but I dont see anything like a isNumeric function, or anything else that will verify only numbers are entered. Did I just miss it or is ther really not a capability to do that?

Also I am a little confused on how to enter validation functions in general. Is there a particular module field in the CRM or Case Management app that has some validation applied to it for reference? I feel like a couple of concrete real world examples of validation would be a big help.

As for adding a field, that’s great! Support to display the phone number as a click to call link would be fantastic. Are the tickets publicly visible, and if so, where? I would like to follow the progress.

Thanks again.

There is no dedicated function to assert numerical values (there is a cast to int but that wouldn’t work for you) and I doubt that checking purely for numeric values would suffice your needs.

You can use the match(string, regex) function to compare the value against a regular expression (the function is not documented, sorry. Use this as a reference until we add it).
Doing a quick google search, something like this should work:

match(record.values.PhoneNumber, "^(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$")

(source: https://stackoverflow.com/a/16699507)

You should stick with E.164 for sure, preferably with a “+” sign because if you are going to use it later (e.g. to call your customer) it would be beneficial. Don’t forget that a phone number could be way longer than 10 digits. Normally, you should check \d{8,15}.

Additionally, you can try libphonenumber in your custom automation if you want to verify and validate your number.

1 Like

Hi @tjerman

None of these links you have provided seems to exist anymore, please let me know the new links how do I create a phone number record that validates if its 10 digits etc long?

My bad; I’ve updated the links in my reply (for the latest version)