- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 09:05 AM
Hi,
I am trying below query to get the users whose start date is today or 15 days from now. However, it is returning users users whose start date is more than 15 days also. Please help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 09:24 PM
Hello @Karishma Dubey
Try below query :
gr.addEncodedQuery('u_user_type=EMP^u_ad_effective_startRELATIVEGT@dayofweek@ahead@14^u_ad_effective_startRELATIVELT@dayofweek@ahead@15^ORu_ad_effective_startONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()^u_processed_by_sml=false');
I have tried like below on due date :
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 06:23 PM
Hey could you please try this filter condition as per your field .
Might be it would be helpful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 08:18 PM
Let's give me query a try.
var gr = new GlideRecord('sys_user');
gr.addQuery('u_user_type', 'EMP');
gr.addQuery('u_processed_by_sml', false);
gr.addQuery('u_ad_effective_start', '<=', gs.daysAgo(-15)); //at or before 15 days from now
gr.addQuery('u_ad_effective_start', '>=', new GlideDateTime()); //at or after today
gr.query();
while(gr.next()){
gs.infor('id: ' + gr.getValue('user_name'));
}
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 09:24 PM
Hello @Karishma Dubey
Try below query :
gr.addEncodedQuery('u_user_type=EMP^u_ad_effective_startRELATIVEGT@dayofweek@ahead@14^u_ad_effective_startRELATIVELT@dayofweek@ahead@15^ORu_ad_effective_startONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()^u_processed_by_sml=false');
I have tried like below on due date :
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 09:32 PM
try script shared by members and share feedback
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader