- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2022 09:38 AM
Hi All,
Im really scratching my head here so please help .
Im trying to create a UI policy that will change the wok notes (internal) field on an incident form to mandatory if the assignment group changes.
We are trying to prevent the cold transferring of incident tickets.
However, in the "when to apply" section, there is no "Changes" operator that i can apply to the assignment group field.
I can compare it to itsself (Assignment group 'is different from' assignment group) but that doesnt work.
If I could get to the 'code' of the conditions somehow then i could add a VALCHANGES operator in there maybe ? But i cant seem to get to the code, only the drop down lists 😞
Could one of you experts please advise what would be the best way to achieve what i am looking to do ?
Apologies if its something simple .. Im not new to coding but im new to the ServiceNow platform and keen to learn.
Thanks in advance
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2022 09:44 AM
Hi,
The UI Policy runs on form load as well as when there's a change to the record (in client view).
For the assignment group field, as you've mentioned, there isn't a "changes" type operator, in the UI Policy settings (there is in business rules, though, just throwing that out there).
For this, you may need to use an onChange client script instead for the assignment group field and then set your field mandatory such as:
g_form.setMandatory('work_notes', true);
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2022 10:00 AM
Thank you Allen,
That works great !
The only downside that i see when compared to UI Policy is that there is no option to reverse the change if the field is then changed back immediately like there is in UI Policy.
Can you see a workaround for that ? or am i being greedy ?
Andy

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2022 10:15 AM
Hi,
In UI Policy it wouldn't work.
Let's say there was a "changes" operator...even if you used that, the system wouldn't know what an "unchange" is because it's still "changed" anyway.
In onChange Client Script, you actually have access to oldValue.
So you could also use:
if (newValue == oldValue) {
g_form.setMandatory('work_notes', false);
}
newValue being what the user just now selected.
oldValue being what the value of that field was on the initial form load.
Please mark reply as Helpful, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2022 10:22 AM
Fantastic !!
That also works great (just needed to add == as a comparator rather than a single 😃
Thank you so much Allen, I love it when things just work like this.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2022 05:50 PM
Hi,
Yeah, I edited my post about 2 seconds after initially submitting it when I saw the one =, haha.
Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2025 12:56 AM
if value changes to cancelled state Additional comments is true mandatory