- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2024 07:48 AM
Hi,
I need to create an on-change client script for the incident form to make the category field visible and mandatory when the business service is set to specific values. Does anyone know what the script would be to achieve this?
Kind Regards
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2024 07:57 AM
You can use the UI policy for this. It will be low code.
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]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2024 07:57 AM
You can use the UI policy for this. It will be low code.
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]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2024 08:26 AM
1. Whenever you want to make any filed Mandator or Read Only and Visible try to use the Ui policies Instead of Any script.
2. if you are having More Ui Policies on the Table then try to use the Order for the Ui policy in order to avoid any Ui policy issues.
3.If you want the Ui Polic to work on when the form is Loading then there is a Check box called " On load ", Please select that.
Regards,
Rudransh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2024 03:52 PM - edited 01-26-2024 03:53 PM
You can use this client script as sample
var spc = g_form.getValue('business service') ;
if (spc ==" A" || spc == "B" || spc == "C") {
g_form.setVisible('category',true) ;
g_form.setMandatory('category', true) ;
} else
g_form.setVisible('category',false) ;
g_form.setMandatory('category', false) ;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2024 04:47 PM
You do not need a script for this. This can be easily accomplished with UI policies
