Want to implement regex validation same like onchange script into the widget

Aman Trivedi1
Tera Contributor

,

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@Aman Trivedi1 

what are you trying to do with that file?

Are you saying user will upload file to this widget and then the data will be fetched from that excel and will be added as Rows to MRVS?

share screenshots.

also is this widget having dependency on some external files since you are parsing excel file?

if yes then share those as well

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar 
So we have one record producer and under that we have one variable "Upload User from excel file"


AmanTrivedi1_0-1755796982705.png


AmanTrivedi1_4-1755798000497.png

 


And we have one MRVS variable set also, below variables are there
- Legal first name
- Legal last name
- Preferred first name
- Preferred last name

So a person needs to fill the data in excel template and Upload it through "Upload External partner excel file"

 AmanTrivedi1_1-1755797263330.png

 


Template:

AmanTrivedi1_2-1755797486145.png


After Upload, we need a validation, for eg: first_name, last name, preffered first name and preffered last name should not contain any special character and a message should be displayed "Invalid Entry. Please remove special character or space". Currently I have made some changes in server script of widget but it is not working as expected

AmanTrivedi1_3-1755797780539.png


So In simple language, we need a validation, when person upload a file
FYI: all those validation logic are written in Server script

AmanTrivedi1_5-1755798140343.png

Server Script:

AmanTrivedi1_6-1755798206829.png

 





@Aman Trivedi1 

Thanks for the info.

So currently which excel columns are getting validated?

enhance the logic there itself

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Only first name and last name but that also not working as expected. If I put a name without any special character or space. its still showing error message.
I want to extend the logic for - Legal first name, Legal last name, Preferred first name, Preferred last name

I am new to this widget thing, I wanted a help to extend the logic. so that it can work for all four column.

AmanTrivedi1_0-1755833793527.png