Check if a Request Item variable contains a number

ClareM
Tera Expert

Hi,

 

I need to check if a Request Item variable (vendor part number) contains a number - this could be made up of letters, numbers or a combination of the two.

 

I'm fairly new to Flow Designer and wondering how best to achieve this?

 

The if flow logic doesn't seem to allow for scripting in order to check for a number.

 

There are some subsequent decisions based on looking up values in a table so I wondered if 'Make a Decision' would be the correct route?

 

Many thanks,

 

Clare

 

1 ACCEPTED SOLUTION

OlaN
Giga Sage
Giga Sage

Hi,

A bit of a clumsy solution would be to check if the input contains any of the numbers you are checking for.
See attached image below.

flow-variable-contains-value.png

I made a little research, to see if it would be possible to build a smarter solution using regex to match for a given pattern instead, but it doesn't seem like this is possible OOB.

In that case you will need to build your own custom action that does this, a good example can be found on YouTube

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@ClareM 

that's correct.

you need to create custom action; pass the variable value as input and inside that input add script to check if the value contains a number and return boolean true/false

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

OlaN
Giga Sage
Giga Sage

Hi,

A bit of a clumsy solution would be to check if the input contains any of the numbers you are checking for.
See attached image below.

flow-variable-contains-value.png

I made a little research, to see if it would be possible to build a smarter solution using regex to match for a given pattern instead, but it doesn't seem like this is possible OOB.

In that case you will need to build your own custom action that does this, a good example can be found on YouTube