- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2015 06:18 PM
My LDAP is occasioanlly putting some junk into my sys_user table. In particular it is inserting a carat (^) character every now and again.
I was hoping to do a quick search for the carat (^) character but search won't do it, neither will the URL based https://<BASE>.service-now.com/sys_user_list.do?sysparm_query=user_nameLIKE^ as service now uses ^ as a logical "and". I have to tried encode ( %5E) but this has no effect.
How do I escape this charater (and other special characters) in either of these scenarios? Or do I need to write some regex ( /^\S*\^\S*$/) and run it in a script?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2015 12:37 PM
1 2 3 4 5 6 7 | var rec = new GlideRecord('sys_user'); rec.addQuery('user_name', "CONTAINS", "^"); rec.query(); while (rec.next()) { var str = 'Found user with carat: ' + rec.user_name + ' sys_id: ' + rec.sys_id; gs.print(str); } |
(Better formatting...)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2015 12:35 PM
Hi Ian
No amount of encoding seems to be working for the caret in the sysparm filter. Good news though, it does work in GlideRecord! Try running this in the "Scripts - Background" module. This worked for me:
var rec = new GlideRecord('sys_user');rec.addQuery('user_name', "CONTAINS", "^");rec.query();while (rec.next()) { var str = 'Found user with carat: ' + rec.user_name + ' sys_id: ' + rec.sys_id;gs.print(str);}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2015 12:37 PM
1 2 3 4 5 6 7 | var rec = new GlideRecord('sys_user'); rec.addQuery('user_name', "CONTAINS", "^"); rec.query(); while (rec.next()) { var str = 'Found user with carat: ' + rec.user_name + ' sys_id: ' + rec.sys_id; gs.print(str); } |
(Better formatting...)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2015 12:39 PM
That would be for the cleanup of users already on your user table. Going forward, you will definitely want to clean that out of your incoming data before committing to your users table by putting in a field script on your ldap import transform map. Transform Map Scripts - ServiceNow Wiki
Hope that helps!
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2015 04:44 PM
Thanks for the tip Ben.
I'm already working through the Transform Map with the LDAP process, as it has other issues as well. <Sigh> The team / person who developed this did not document or comment anything, and it doesn't look like its been looked at since Aspen/Berlin.