Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Can we query with catalog item variables while gliding RITM table ?

sr_surendra
Giga Expert

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

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@sr.surendra@tcs 

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');

find_real_file.png

find_real_file.png

Regards
Ankur

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

View solution in original post

5 REPLIES 5

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