- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 05:56 AM
How to write warning message in catalog items using UI policy ?
Can someone please assist me regarding this query? I have written a UI Policy but its still not showing message.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 06:21 AM
hello
no need of scripting here
just put the condition of the UI policy as
date field before today
and in script use the message g_form.addWarningMessage('your message') in "execute if true" field
or g_form.showFieldMsg("field name', 'Warning msg');
make sure you select the type as ALL in the run script
Hope this helps
mark my answer correct if it helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 06:00 AM
Hello
you can use this
g_form.addWarningMessage('your message');
mark my answer correct if it helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 06:01 AM
Hi,
you can try it on client scripts to display the field message.
Thanks,
Pavankumar
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 06:04 AM
Hi
In the screenshot you mentioned, there is a field "Run scripts in UI type"
Change its value from Desktop to ALL.
Mark as correct and helpful if it solved your query.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 06:06 AM
A couple possible items:
- for showFieldMsg you need type as the third parameter (or you can use showErrorBox instead to not need to have the type)
- If you're viewing the form in the portal, you need to update the "Run scripts in UI type" to all
- The field name would be the backend name (just mentioning because the example doesn't follow backend naming conventions with underscores).
However, I would be inclined to do this in a catalog client script (onchange for the trigger field) rather than in the ui policy.