Validation on comma separated values

KARAN24
Tera Contributor

Hi Team,

 

I have a requirement,

We have a catalog item,where we have one variable called as'TAX ID' which is single line text field.

so users should enter the TAX ID manually,and after that we have to validate whether the 'tax id ' entered is correct or not,We are getting the 'TAX ID' from integration and is stored in tax table.

 

So,whenever users enter the 'TAX ID' manually we have to validate if the entered value is present in the table or not.

 

Issue is some values in the Tax table are stored as comma separated values as shown below:

KARAN24_0-1672732045455.png

But the users can enter only one value,so how to validate that.

 

Thank,

Karan

6 REPLIES 6

RaghavSh
Kilo Patron

1.You can use on change client script in your catalog form.

2. You will need to use GlideAjax as server side code will be required to check the tax table.

3. you need to query the Tax ID column of your table and check if the value entered is one of the values in table.

4.  refer : https://docs.servicenow.com/en-US/bundle/tokyo-application-development/page/script/ajax/topic/p_AJAX... 

 


Raghav
MVP 2023

KARAN24
Tera Contributor

Hi Mega,

Thanks for your response,but mine issue is :

 

I have this Tax ID Column in Tax table ,here the values are comma separated.

KARAN24_0-1672739752180.png

But user can enter only one Tax ID ,suppose if the user enters 789,then also it should validate and user should be able to submit the form.How this can be done.

 

Thanks,

Karan

You need an on change client script using glideAjax as suggested in above post. Once you have written that, the comma separated issue can be handeled.

 


Raghav
MVP 2023

Community Alums
Not applicable