Populate a Field Based on Date Selection in Date Type Field

nlopez4
Tera Contributor

Hi all,

 

I have a Single Line Text type field titled urgency_level and a Date type field titled expected_go_live_date. The urgency_level field will have four choices: Critical, High, Medium, and Low. I would like to set the urgency_level field to one of those choices based on the following logic:

 

  • Critical if the expected_go_live_date is 48 hours or less from now to the selected day
  • High if the expected_go_live_date is 48-72 hours from now to the selected day
  • Medium if the expected_go_live_date is five to nine days from now
  • Low if the expected_go_live_date is ten or more days from now

 

I started to create an onChange Catalog Client Script to try and accomplish this, but I admittedly don't know much about JavaScript. Any help is appreciated, thank you!

2 REPLIES 2

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @nlopez4 

 

Baseline code: 

 

https://www.servicenow.com/community/itsm-forum/set-manager-name-based-on-selected-user/m-p/628461

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Thank you for your reply! Unfortunately, I was unable to solve the issue with the solution from the link you provided.