- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2018 11:31 AM
Greetings Earthlings!
We have activated the Fiscal Calendar plugin and now we want to use it.
Input: Today's Date
Output: The Quarter of the input
Is there a "isInFiscal" function / library that we can leverage to pull this out?
Here's the screenshot of our table below, for 'fiscal_period'.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2018 09:49 AM
Hi Mauricio,
At the moment there are no APIs to provide that.
Nevertheless its quite straight forward to get the fiscal quarter based on the date.
var dateObj = new GlideDateTime();
var gr = new GlideRecord("fiscal_period");
gr.addQuery('fiscal_type', 'quarter');
gr.addQuery('fiscal_start_date_time', "<=", dateObj);
gr.addQuery('fiscal_end_date_time', ">=", dateObj);
gr.query();
if (gr.next()) {
return gr;
}
Cheers,
Sunil B N
P.S: Please mark this as an answer/helpful if it was useful to you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2018 09:49 AM
Hi Mauricio,
At the moment there are no APIs to provide that.
Nevertheless its quite straight forward to get the fiscal quarter based on the date.
var dateObj = new GlideDateTime();
var gr = new GlideRecord("fiscal_period");
gr.addQuery('fiscal_type', 'quarter');
gr.addQuery('fiscal_start_date_time', "<=", dateObj);
gr.addQuery('fiscal_end_date_time', ">=", dateObj);
gr.query();
if (gr.next()) {
return gr;
}
Cheers,
Sunil B N
P.S: Please mark this as an answer/helpful if it was useful to you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2021 11:56 AM
Hi Sunil,
I have a similar scenario where I need to query Fiscal Period to get the current quarter based on a field date on a form (u_entry_date).
The intent is when the u_entry_date changes, the Quarter field (u_quarter) on the form gets populated as well. I've tried flow designers to query, but it is not working.
var entry = current.u_entry_date;
var gr = new GlideRecord("fiscal_period");
gr.addQuery('fiscal_type', 'quarter');
gr.addQuery('fiscal_start_date_time', "<=", entry);
gr.addQuery('fiscal_end_date_time', ">=", entry);
gr.query();
if (gr.next()) {
current.u_quarter = 'quarter';
current.update();
Any suggestions?
Thank you.