Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Please help me how to validate UUID format in Server side scriptbelow script always returning "Not V

LegataLeah112
Kilo Contributor

Please help me how to validate UUID format in Server side scriptbelow script always returning "Not Valid" 

3 REPLIES 3

Maik Skoddow
Tera Patron
Tera Patron

Not sure, what your question is about and the mentioned code is also missing.

J Siva
Kilo Patron
Kilo Patron

Hi @LegataLeah112 

Try the below script.

var uuid = 'f47ac10b-58cc-4372-a567-0e02b2c3d479'; // replace with your UUID variable

var uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;

if (uuidRegex.test(uuid)) {
  gs.info('UUID is valid');
} else {
  gs.error('UUID is invalid');
}

 

Regards,

Siva

Ankur Bawiskar
Tera Patron
Tera Patron

@LegataLeah112 

what's your business requirement?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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