Guilherme B
Giga Guru
Giga Guru

What are masks?
They are a way to restrict the data users can input by enforcing specific formatting. Here are some examples: Zip code, credit card, phone.
#####-##
(###) ###-####
###-###
Why are they better than regex validation?
They compel users to input good data right away, eliminating the need for OnChange validation. Additionally, accessibility readers struggle to interpret error tooltips for fields.
How to set it up?
In this case, we'll configure it with a phone number in a catalog item.
1 - Navigate to the theme of your Service Portal.
2 - In the related list at the bottom of the page, look for 'JS Include' and click on New.
3 - Add the IMask record.

1.jpeg

4 - Add a single-line phone number variable to the catalog item.

2.jpeg

5 - Add a catalog OnLoad script and set the mask.
3.jpeg

Note: sp_formfield_phone_number refers to the variable name, and the Isolate Script needs to be 'Yes'.

Result:
4.jpeg

Comments
renanacavalcan
Tera Explorer

Hi, Guilherme
Can I create a mask like this directly in a field of the table?

 



maskTable.png

Version history
Last update:
‎02-29-2024 05:56 PM
Updated by:
Contributors