We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

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

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

J Siva
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

@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  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader