Need to restrict Fiscal periods on the demand cost plans based on the selected date
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2024 09:41 PM - edited 08-26-2024 09:56 PM
Hi All,
We have to restrict the fiscal period on cost plan table.
We have a new field called fiscal period. We need to compare fiscal periods with the freeze date field. I am converting it from date to date/time code was not working.
If the freeze date was yesterdays date then current month should not be visible today, if it is future then current month also should be visible.
Below script was not working as expected.
var grFiscalPeriod1 = new GlideRecord('fiscal_period');
grFiscalPeriod1.addEncodedQuery('fiscal_type=month');
grFiscalPeriod1.query();
while (grFiscalPeriod1.next()) {
var new_date = grFiscalPeriod1._freeze_date;
var time = '11:59:59';
var date_timeee = new_date + ' '+ time;
var dat = new GlideDateTime(date_timeee);
var ans1 = new GlideScheduleDateTime();
ans1.setValue(dat);
var today1 = new GlideDateTime();
if (dat >= today1) {
//count++;
list += (',' + grFiscalPeriod1.sys_id);
}
}