
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2024 07:38 PM
I am working on the query on a related list that will show cases with same account and service offering that are opening in the last 30 days. The below is my query. Everything is workiing but the timestamp piece. Please help.
current.addQuery('u_task_account', parent.u_task_account);
current.addQuery('service_offering', parent.service_offering);
gr.addEncodedQuery("sys_created_onONLast 3 months@javascript:gs.beginningOfLast3Months()@javascript:gs.endOfLast3Months()");
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2024 04:52 AM - edited 03-30-2024 04:55 AM
I just realized you're using gr and current objects. For your encoded query, you need to change gr to current. As it is, you have two different GlideRecord objects in use. So your call to query() is only going to work with one of them in that piece of code.
Or change current to gr. This is probably what you want. Without seeing the rest of your code, I'm assuming current is the already defined current object.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2024 07:54 PM
Hey Shannon-
You said last 30 days but your encoded query is for the last 3 months. Maybe try this instead:
current.addQuery('u_task_account', parent.u_task_account);
current.addQuery('service_offering', parent.service_offering);
gr.addEncodedQuery("sys_created_onONLast 30 days@javascript:gs.beginningOfLast30Days()@javascript:gs.endOfLast30Days()");
HTH
-Roger

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2024 08:04 PM
Originally they asked for 30 days but wanted to extend to 3 months. It doesn't work with either query unfortunately.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2024 04:52 AM - edited 03-30-2024 04:55 AM
I just realized you're using gr and current objects. For your encoded query, you need to change gr to current. As it is, you have two different GlideRecord objects in use. So your call to query() is only going to work with one of them in that piece of code.
Or change current to gr. This is probably what you want. Without seeing the rest of your code, I'm assuming current is the already defined current object.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2024 09:47 AM
I updated the last line to the below:
current.addEncodedQuery("sys_created_on>javascript:gs.beginningOfLast90Days()");
It is working as expected now.