Remove whitepaces from Get API Table sysparm_query value

fklenner
Mega Contributor

Hi together,

 

I have the following problem in ServiceNow:

We execute a Get API Table command to identify a user in ServiceNow by phone number.

The problem is that in ServiceNow the phone numbers are stored with whitespaces e.g.: +49 1111 222222 and in another system we get the number without spaces.

It is possible to modify the phone number in the other system so that we insert the spaces in the appropriate places and then the sysparm_query command works. Unfortunately, landline numbers have spaces in different places and therefore it is not possible to modify them.


Our query:
sysparm_query = "sys_usersysparm_query=mobile_phone=CallerID&sysparm_fields=name%2C%20phone%2C%20sys_id%2C%20mobile_phone&sysparm_limit=1"

Is there a way to trim numbers in the column in the sysparm_query command or maybe another approach to solve the problem?

 

Thanks in advance

Florian

1 REPLY 1

Mark Manders
Mega Patron

No. You can't do that in the query command. A workaround could be to hide a new field on the user form, taking the phone number, get the spaces out of it and putting it in the field and query to that field.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark