How to remove leading and trailing spaces for a reference field for eg. Caller

Tabassum Sulta1
Kilo Contributor

Hi Everyone,

I am trying to remove/trim the leading and trailing spaces on a reference field eg. Caller.

Use case:

 In the "Caller" field, if you have leading whitespace or trailing whitespace (say, from copy/paste function), it will fail to find the user. As a programmer, I always remove leading/trailing whitespace from user input to ensure proper matches in search routines. How can we achieve it on a reference field. Please help me out.

4 REPLIES 4

Mike Patel
Tera Sage

You can use trim on onchange or celledit client script

refer to 

https://hajsoftutorial.com/trim/

https://www.tutorialspoint.com/java/java_string_trim.htm

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

the reference field is not where user can type in free form text so removing leading and trailing spaces doesn't make sense

Also if they want to populate value in there they need to give proper value or use lookup icon and then select the record

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

@Tabassum Sultana 

Hope you are doing good.

Did my reply answer your question?

If my response helped you please mark it correct to close the question so that it benefits future readers as well.

Regards
Ankur

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

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Is there any update on this? Is this question resolved or you need some more assistance.

Please consider marking appropriate reply as Correct & 👍Helpful.

Regards
Ankur

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