How to achieve this in service portal widget

VikramM1
Tera Contributor

I need to create a catalog item with a variable which accepts date. When user requests an catalog item, it should check if the date entered in date variable is it from past. If yes, then it should display one alert message and clear the value from date field and abort the submission.

2 ACCEPTED SOLUTIONS

Anurag Tripathi
Mega Patron
Mega Patron

This is not about widget but just a  catalog item thing.

You need to create a variable on the catalog item(maintain items -> find your item -> New Variable)

then Add a UI policy that checks if the date ins i9n past and throw error -> EG here No Code date validations through (Catalog) UI Poli... - ServiceNow Community

-Anurag

View solution in original post

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @VikramM1 

 

You can create a Catalog Item

Under that create a Variable of Date Type

 

In Catalog UI policy

put condition

variable date is before Today

If yes

In script 

add alter message and your work done. 

 

Please try the same and share feedback.  

*************************************************************************************************************
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]

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

View solution in original post

3 REPLIES 3

Anurag Tripathi
Mega Patron
Mega Patron

This is not about widget but just a  catalog item thing.

You need to create a variable on the catalog item(maintain items -> find your item -> New Variable)

then Add a UI policy that checks if the date ins i9n past and throw error -> EG here No Code date validations through (Catalog) UI Poli... - ServiceNow Community

-Anurag

I Know But, i need to display the field in Service portal widget and keep this validation from Widget.

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @VikramM1 

 

You can create a Catalog Item

Under that create a Variable of Date Type

 

In Catalog UI policy

put condition

variable date is before Today

If yes

In script 

add alter message and your work done. 

 

Please try the same and share feedback.  

*************************************************************************************************************
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]

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