Date field with only month and year

Nithin21
Tera Expert

On the contract table (ast_contract),  financials tab provides monthly and yearly value based on start and end date.

 

user would like to select month and year (example a date field) and see what is the total cost of the contract as of that month and year 

 

Option 1) provide a dropdown with list of choices for month and year. This option is not scalable

 

Option 2)  provide date field with only month and year . Is this possible ? 

 

Option 3) provide date field. User selects dd/mm/yyyy. Parse the month and year from the date selected. Causes confusion to the user.

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Nithin,

you can have below approach:

1) choice field with value for months as Jan, Feb, Mar, etc

2) choice field with value for year 2020, 2021

here you will have to run a scheduled job to insert choice value for the year field; this job would require to run start of the year

Or instead of having the above approach best is to have date field; parse it

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

Hello @Ankur Bawiskar ,

2) choice field with value for year 2020, 2021

can you please guide on how to create year drop down with only years, e.g., from current year to 2050.

Any suggetsion is highly appreciated.THANKS!