Which executes first ,UI policy action or UI policy script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2019 07:51 AM
When runnning ui policies ,which executes first ,whether UI policy action or UI policy script?
- 17,946 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2024 01:50 PM
Yes. Here is what I just now tested with:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2024 08:14 PM - edited ‎01-31-2024 05:43 AM
function onCondition() {
for (i = 0; i <= 1000; i++) {
g_form.addErrorMessage('Count ' + i);
}
g_form.clearMessages();
g_form.addErrorMessage('Execute if true');
}
function onCondition() {
for (i = 0; i <= 500000; i++) {
g_form.clearMessages();
}
g_form.addErrorMessage('Execute if true');
}​
This tells me that the script runs before the actions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-09-2024 01:15 AM
Thanks but my response was based on what is in ServiceNow ebook. Guess ServiceNow will need to update their ebook 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2025 10:07 AM
I completely agree. If it should match the book, then they should fix whatever is wrong.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2024 03:36 AM
UI Policy action executes before the UI policy script.
You can test it by creating UI policy on the form for a particular field, e.g. category on incident form. In that, write UI policy script and create one UI Policy action. Then, go to Preferences->Developers->Click on JS Log and Field watcher, make it true. Then, you can Field Watch the category on incident form. You will see the execution order clearly in Field Watcher.
You can refer to the screenshot attached herewith.