Phone number fields on sys_user table. Mandatory area code.

Scott93
Tera Contributor

I would like to like to make the business phone and mobile phone fields only accept the following format:

(xxx) xxx xxxx.   

 

I understand the old Phone Number field data type "inherits from a string".  Problem is I cannot find any entry with "phone" under sys_ui_script.list.

 

At this moment I'm not interested in trying to set up and configure Phone Number (E164), especially as I cannot find glide.phone_number_e164.display_national under sys.properties.list or I would be busy with experimenting with that.  Also, once I set a field to that data type, I cannot set back to legacy Phone Number data type. 

 

There are many articles but most reference Phone Number (E164) and this one:

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0752372

only talks about creating a new UI script and mentions editing line 16 in a script that is never given.

 

Appreciate any help. 

 

2 REPLIES 2

jMarshal
Mega Sage
Mega Sage

That KB article isn't talking about writing your own UI Script, but rather "formatting.js" script, which exists on all instances and referenced in the previous step (https://<instance-name>.service-now.com/scripts/formatting.js).

 

However, I would recommend writing a data policy to enforce this. You could write it to take the user input on the Phone Number field (string data type) and format it as you like...rather than forcing the user to enter it a particular way. If you really want to force the user to do it, use an onChange client script, which blanks out the field and makes it mandatory.

Scott93
Tera Contributor

jMarshal,

 

Thank you.  I was thrown off by Steps 1 & 2 but now see it is a simple copy and paste method.

 

I'll look into writing a data policy for the phone # fields and will let you know how it works out. 

 

I'