I need help putting a script in a UI Policy

raphaelfp
Tera Contributor

Hello, I'm new in servicenow and I'm trying to put a script in my UI Policy for a form. But when I activate the "run script' checkbox, it directs me to this page.

 

raphaelfp_0-1727348038441.png

also when I put a script from this list and save it won't update. And in the checkbox there is this text 'If Run scripts is selected, a specified script is be executed when the UI Policy Conditions evaluate to true. Another script is executed when the conditions evaluate to false."

 

1 ACCEPTED SOLUTION

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @raphaelfp 

 

Change to advance view

AGLearnNGrow_0-1727354521988.png

and 

AGLearnNGrow_1-1727354567544.png

 

 

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

2 REPLIES 2

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @raphaelfp 

 

Change to advance view

AGLearnNGrow_0-1727354521988.png

and 

AGLearnNGrow_1-1727354567544.png

 

 

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

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

Jitendra Diwak1
Kilo Sage

Hi @raphaelfp,

 

Please avoid using script in UI Policy. It is basically used to make the field mandatory, readonly ans visible. To write the complex scenario we ahould go for client script as per tour requirements. 

 

 👍

Please accept my solution if it works for and thumps up.