- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2024 04:40 AM - edited ‎10-09-2024 05:19 AM
Hi team,
I have requirement to send notification one day before and one day after a variable date field in catalog item. I used scheduled job,event and notification for that...but when its running daily its sending notification everyday and it seems not working....like if i keep date as 9oct in date field in catalog form so one noti should be send on 8 and one on 10th but it seems not working can anyone please help me attaching schedule job script here:- @Sandeep Rajput @Dr Atul G- LNG
Before:-
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2024 02:08 AM
Hello Priyanka,
Can you try this below,
I have executed this in background script, also I see that this is a date/time field so getDisplayValue will not work properly, just getDate should do that job.
var catalogItemSysId = '6830ece6937056109458f44e1dba10ee';
var variableDateField = 'expected_return_date';
var grBefore = new GlideRecord('sc_req_item');
grBefore.addQuery('cat_item', catalogItemSysId);
grBefore.query();
while (grBefore.next()) {
var dt = grBefore.variables[variableDateField];
if (dt) {
var expectedDate = new GlideDateTime(dt);
gs.info('expectedDate' +expectedDate);
var today =new GlideDateTime();
var oneDayBefore = new GlideDateTime(dt);
oneDayBefore.addDays(-1);
gs.info('today' +today);
if (today.getDate().getNumericValue() == oneDayBefore.getDate().getNumericValue()) {
{
gs.eventQueue('loaner.request.one.day.before', grBefore, grBefore.requested_for, '');
}
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2024 07:50 PM
No its not related to that i think if you built a scenerio at you end and try u will get it @Omkar Mone Just try in one catalog item with date field and check before and after noti because its not working really
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2024 05:01 AM
Any update @Omkar Mone ??

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2024 04:57 PM
Hello @Priyanka Chaud1 ,
It's working just fine as per my knowledge. Can you please put some logs around the dates of the above working code, and share please
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2024 08:36 AM
I modified the code put some logs as well but still its not working.......i submitted 2 request in 1 i kept expected date as 14 and in one 15...when i runned in background script ....email got triggerred for both...but as its 13 today only for one RITM email should have been triggered...talking about before script @Omkar Mone

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2024 08:57 PM
Hello Priyanka,
Till where did you get logs? Can you paste the output of your background script please?