- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2021 07:07 AM
Hi Team,
How to select only year from date field.
please any one help on this.
Regards,
Pushpa
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2021 07:52 AM
Hi,
for that you can use onLoad client script with GlideAjax
1) script include will check which is the current quarter and based on that hide the other quarter
Sample script to determine the quarter in server side
var test = new GlideDateTime();
var month = test.getMonth();
var quarter = Math.ceil(month/3);
gs.info('Current quarter is->'+quarter);
Output:
[0:00:00.069] Script completed in scope global: script
Script execution history and recovery available here
*** Script: Current quarter is->2
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2021 07:24 AM
Hi,
Please explain your business requirement in detail.
Since that is OOB Date field you need to select the complete date year, month and day
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2021 10:19 PM
Hi Ankur,
i have Quarter drop down field Q1,Q2,Q3,Q4 i want to select year one more field. (only year need to select)
Regards,
Pushpa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2021 10:34 PM
Hi,
then you need to create choice values and use choice field
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2021 07:42 AM
Hi,
if current year is 2021 and current month is september, then Q3& Q4 shouble be visible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2021 07:52 AM
Hi,
for that you can use onLoad client script with GlideAjax
1) script include will check which is the current quarter and based on that hide the other quarter
Sample script to determine the quarter in server side
var test = new GlideDateTime();
var month = test.getMonth();
var quarter = Math.ceil(month/3);
gs.info('Current quarter is->'+quarter);
Output:
[0:00:00.069] Script completed in scope global: script
Script execution history and recovery available here
*** Script: Current quarter is->2
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
