How to modify date field to pick only month and year

Asif_Jawed
Tera Expert

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. 

Screenshot 2023-07-07 111000.jpg

 

2 ACCEPTED SOLUTIONS

Samaksh Wani
Giga Sage
Giga Sage

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

View solution in original post

@Asif_Jawed 

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

7 REPLIES 7

@Asif_Jawed 

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hello Asif,

 

If the responses shared my me are helpful to you, Plz mark it as Accept Solution, it will help other user as well.

 

Regards,

Samaksh

Sure. Thank you