- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 05:54 PM - edited 07-25-2023 06:01 PM
Hi!
We have a requirement where we need to set the Priority to field to --None-- (this is from the Dropdown with None) when a case form is newly created and HR Service = "HRServ1" (sample only)
I achieved this using UI Policy but the problem is, when we changed the Priority value to other options then click Save or Update button, it goes back to Priority value "--None--"
Thanks in advance
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 07:39 PM
Hi UI Policy will not work for this since it will run on each onload, you can go for before insert Business rule and set priority to none as this BR will run only once that is during case creation.
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 06:06 PM
How is your UI policy set up? Sounds like you still have something running onLoad
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response helped in any way
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 06:12 PM
@DanielCordick this is the script in UI Policy. I've set the condition per requirement in When to Apply.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 06:18 PM
Make sure your UI Policy condition when to apply is correct.
another way include a if condition to check and then set to none inside if
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 06:06 PM
Hi, I think you have 2 options
Client API has a isNewRecord() method to test if the record is 'new'
GlideForm | ServiceNow Developers
Also if the record is new then the sys_id will be -1
You should be able to test the state of your record using either of these in your script
and only apply your priority when the record is new.
I would recommend using isNewRecord() and the API documentation example is everything you will need.
function onLoad() {
if(g_form.isNewRecord()){
alert('New Record!');
}
}