Why below script/ query is not working after passing 2 dates in addEncodedQuery ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2024 07:49 AM - edited 09-16-2024 10:12 AM
Hi All,
I am trying to pass 2 dates in addEncodedQuery but its not working. There is some mistake while passing the dates parameter but not clear on this. Please suggest.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2024 08:06 AM
Hello @Virendra K ,
Can you change the query2 and check?
FROM: schedule.type=blackout^schedule.name=Central Winter Break
TO: schedule.type=blackout^name=Central Winter Break
If my response helps you in any way, kindly mark this as Accepted Solution/Helpful and help in closing this thread.
Regards,
Shubham

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2024 08:49 AM
Hi @ShubhamGarg
Thanks for the reply.
Query is working with "schedule.type=blackout^schedule.name=Central Winter Break" but if we adds "^u_start_time>=javascript:gs.dateGenerate('2024-09-16','09:08:46 AM')^u_end_time<=javascript:gs.dateGenerate('2024-09-17','09:08:46 AM')" then its not working. so problem is in date parameters.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2024 10:15 AM
Hello @Virendra K ,
I see you have used u_start_time and u_end_time. Is it correct? Are you using custom fields?
Reason being, we have Out of box fields Start date time (start_date_time) & End date time (end_date_time) for this table.
https://<instance-name>.service-now.com/sys_dictionary_list.do?sysparm_query=name%3Dcmn_schedule_span%5Ecolumn_label%3DEnd%20date%20time%5EORcolumn_label%3Dstart%20date%20time&sysparm_first_row=1&sysparm_view=
Hope this helps. Let me know if it doesn't.
If my response helps you in any way, kindly mark this as Accepted Solution/Helpful and help in closing this thread.
Regards,
Shubham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2024 11:53 AM
HI @Virendra K ,
Please refer below thread:
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda