GlideSystem - endOfNextWeek()

Gets the date and time for the end of next week in GMT.

Table 1. Parameters
Name Type Description
Table 2. Returns
Type Description
void The GMT in the format yyyy-mm-dd hh:mm:ss.

Scoped equivalent

To implement the endOfNextWeek() functionality in a scoped application, first create a script include that returns the GlideDateTime that is set to the end of next week. For example:

var DTUtil = Class.create();
DTUtil.prototype = {
    initialize: function() {
endOfNextWeek: function() {
var nextWeek = gs.endOfWeek();
gs.debug("End of week: {0}", nextWeek);
var gdt = new GlideDateTime();
gs.debug("End of next week: {0}", gdt.getDisplayValue());
return gdt;
    type: 'DTUtil'

This script include is available to all application scopes and is client-callable.

Next, use Scripts - Background to update your sys_report filter to use this script include. To update the filter, you need the sys_id of your sys_report. You should also note the scope to which you added the script include and use that scope name in the setValue name of your script. For example, assuming your report sys_id is "4dc5e0e7c3103200f7d1ca3adfba8f52" and the scope of the application is sn_scope:

var gr = new GlideRecord('sys_report');
gr.setValue('filter', 'sys_created_on<=javascript:new sn_scope.DTUtil().endOfNextWeek()^EQ^GROUPBYsys_created_on');

This code runs in the same scope as the report.