- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2023 10:43 PM
I have a field of type 'date' in catalog item and i want to pick only month and year. Currently the pop up window is showing date, month and year but i want only only and year to pop up and after selecting it. The month and year should display in the field. example: July, 2023 or June - 2022.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2023 10:48 PM
Hi Asif,
Create a two field of dropdown, One for Month and One for year, But for Storing purpose you can concatenate both values like this:- July 2023
Because in the out of the box calendar, date picker will always be present.
Plz Mark my Solution as Accept and give me thumbs up.if you find it helpful
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2023 10:58 PM
to ensure year is dynamic you can add as of now 10 years such as 2022 to 2032 in the choices
Ensure you create a scheduled job which runs every 5-10 years which adds new choices to that choice variable such as when job runs in 2028 then it will add new choices from 2028 onwards etc
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2023 10:48 PM
Hi Asif,
Create a two field of dropdown, One for Month and One for year, But for Storing purpose you can concatenate both values like this:- July 2023
Because in the out of the box calendar, date picker will always be present.
Plz Mark my Solution as Accept and give me thumbs up.if you find it helpful
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2023 10:53 PM
Please check response shared by @Samaksh Wani
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2023 10:54 PM - edited 07-06-2023 10:56 PM
Hi @Samaksh Wani ,
Thank you for replying so fast.
How to concatinate both values and moreover if I create two dropdown then the year dropdown should have all the year dynamically.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2023 10:57 PM
Hello Asif,
In that case plz use normal date picker and select date as 1 only but for storing purpose, you can trim or make substring of only month and year.
You need to write a script for that using Javascript functions.
Plz Mark my Solution as Accept and give me thumbs up.if you find it helpful
Regards,
Samaksh.