Allocation Expiry Notification

jp_rayudu_0909
Tera Contributor

Hi all,

we have a scheduled job to fire a notification which the scheduled job is run's daily and to trigger a notification we have a script include where OOB functionality is notification triggers to end date which is 30 days prior to today. but here we need to some customizations to trigger notification within 30days and here schedule job will run weekly basis so no repeated Notifications.

scheduled job:

jp_rayudu_0909_1-1729255522525.png

this is the function where i added Operator to trigger notification within 30days to end date.

 getExpiringAllocationsNotificationDetails: function() {
        var allocationsGoingToExpire = [];
        var daysToBeConsideredForNotifying = WSMConstants.ALLOCATION_EXPIRY_DAYS;
        var dateToBeNotifiedFor = new GlideDate();
        dateToBeNotifiedFor.addDaysUTC(daysToBeConsideredForNotifying);
        var allocationGr = new GlideRecord(WSMConstants.TABLES.CC_DEPT);
        allocationGr.addActiveQuery();
        allocationGr.addQuery('end_date', '<=', dateToBeNotifiedFor);
        //allocationGr.addEncodedQuery('active=true^end_dateRELATIVELT@dayofweek@ahead@30');
        allocationGr.query();
        while (allocationGr.next()) {
            var recipients = this.getRecipients(allocationGr);
            allocationsGoingToExpire.push({
                'allocationId': allocationGr.getValue('sys_id'),
                'recipients': recipients
            });
        }
        var recipientsToAllocationMap = this.getAllocationAssociatedWithRecipients(allocationsGoingToExpire);
        return recipientsToAllocationMap;
    },
any suggestion to get notification triggers within 30days
0 REPLIES 0