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.

How to get encoded query display value

lucky6
Tera Contributor

Hi Everyone,

I want to get date time fields display values so how can i get it in encoded query .

Example: opened on today

opened_atONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()

12 REPLIES 12

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

if you want to get the display value from Table API point of view then you need to set this parameter as true

sysparm_display_value = true

Regards
Ankur

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

Hi,

I need to achieve this in scripted rest api, i have added encoded query as well .

Hi,

So you will be getting this encoded query inside Scripted REST API.

Can you share the exact method how it would be received

What should be the response? which table you want to query with that query?

Regards
Ankur

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

var table = 'table',

gr = new GlideRecord(table);

gr.addQuery('opened_atONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()');

gr.query();
while (gr.next()) {
var fields = {};
fields.Number = gr.number + '';

}

return fields;