Need to call system property in UI policy client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2024 11:42 PM - edited 12-05-2024 11:53 PM
I have UI policy script doing some function.
In that I am checking for particular order guide using sys_id.
I need to replace that sys id with system property.
I have written script include for the same but it is not working.
SI:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2024 03:07 AM
Hello @Aswin Chandras1
Can you add log statements (alert in the client script) to know which value it is returning?
In the if condition you are checking with finalParam where it is defined?
It should be against the returned value right?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2024 03:09 AM
You should start troubleshooting by alerting/logging 'prop' to see if you are getting the expected response. You are not using 'prop' in the rest of the script, which should also be enclosed in the myCallBack function, and finalParam is not defined. If this is a partial script, that's not as helpful for troubleshooting purposes. This script may not even be running as the conditions/trigger on scripted UI Policies can be tricky. If you find this to be the case, use an onLoad and/or onChange Catalog Client Script Instead.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2024 07:02 AM
Hi Brad,
This is my whole script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2024 03:17 AM
your script is not correct. it seems you pasted only partial script
both UI policy and script include are in same scope?
Since you want to run it via script, Don't give any condition to your UI policy
Have you ensured Run scripts checkbox is marked as True so that the script runs.
Please add the script in "Execute if true" section
If yes then are you sure client callable is checked on script include.
Did you try adding gs.info() in your script include function?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader