Multiple Field Changes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2024 01:17 PM
Hello,
I have a requirement where I have 20 fields on a form and if I change the value of any of fields , I have to set a justification field to mandatory and set it to focus and have the user provide a reason before saving the form.
I used a business rule to check if the field changes and display a message but the mandatory or focus part i can't do it in a BR. Any suggestions?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2024 09:02 PM - edited 01-26-2024 09:08 PM
Hi @Liz Abraham
Have you tried this KB article for focus ...
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0694100
**Note : The solution is not provided by ServiceNow
You can use client ui policy like below :
Use OR conditions to validate
& In script section write below code :
g_form.setMandatory('<Field Name>',true);
g_form.getControl('<Field name>').focus();
Here I tried for description field
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2024 04:45 PM
Yes, I did,and didn't work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2024 06:45 AM
Hi @Liz Abraham
You can use UI policy.
condition
field changes to ....
UI action
Make rest field mandatory.
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-27-2024 07:36 AM
UI Policy conditions do not support field changes… and for good reason:
This would also fundamentally break to concept of UI policies - how should mandatory and visible states be handled when a field changes? This would result in totally unclear states. It would also neglect the „Run if false“ idea…
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2024 03:24 PM
Thanks everyone, for your feedback. I actually tried something and I am yet to fully test it , but what i did was create a BR that checks to see if the field changes using the conditions and a script to just say that a justification is required. But i created another field that set the field Value to yes if any of the 20 fields change and then using that field, i created a UI policy to check to see if that field value is yes to set the justification field to mandatory.
Will have to test it , may not be the best approach.