How to get encoded query display value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2020 02:43 AM
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()
- Labels:
-
Customer Service Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2020 04:01 AM
Hi,
So you are applying query to your table then which display value you want to fetch for which field?
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
‎10-27-2020 04:24 AM
opened and closed dates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2020 04:46 AM
Hi,
updated script below
Ensure you give proper field name, table name etc
(function process( /*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
var arr = [];
var table = 'table',
var 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 + '';
fields.Opened = gr.opened_at.getDisplayValue();
fields.Closed = gr.closed_at.getDisplayValue();
arr.push(fields);
}
response.setStatus(200);
response.setBody(arr);
})(request, response);
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
‎10-27-2020 05:01 AM
HI,
I got your point here but i want query string display value , but here you are sending those fields in respsonse .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2020 05:06 AM
Hi,
How is the API being consumed?
I didn't get your point on you want display value of the query string.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
