- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2020 07:52 AM
Dear all,
I have date field on catalog item form which I want to query with existing date.
For that I tried like below-
var a = new GlideRecord('sc_req_item');
a.addQuery('cat_item.variables.date_variable',gs.now());
a.query();
I'm not able to think of some another way to query and this one is not working.
Could someone please help me understanding how we can do this?
Regards,
Surendra
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2020 08:09 AM
you can query like this
give the variable sysId there
var a = new GlideRecord('sc_req_item');
a.addQuery('variables.sysId',gs.now());
a.query();
Generic Approach:
You can form the query from the table list and then copy the query and then use it
Select the Variables -> Select your catalog item -> Select your variable -> value to search
For me it looked like this
a.addEncodedQuery('variables.9415cd6f0750ec90540bf2508c1ed042=testing');
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2020 08:18 AM
Thanks Ankur,
That was helpful.
I checked my script by adding "getRowCount()" and its giving me correct amount of records as I required.
I can update my script accordingly
Regards,
Surendra