Catalog UI Policy Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2023 06:42 AM - edited 11-23-2023 09:28 AM
Hello everyone!
Can someone help me with the catalog UI policy script? I need to show the download link field if the product field is not VPN. However, the product field is populated through a client script. How can I make a script for this one? Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2023 08:27 AM
Why do you need to script this?
Just add the UI Policy action that sets the app. req. template field's visibility.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2023 08:29 AM
Because the visibility of the app.req field is dependent on the product field which value comes from the client script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2023 09:15 AM - edited 03-15-2023 09:16 AM
I realized in the mean time that the problem is that you are conditioning the visibility upon a variable which cannot be selected in the condition builder.
You can refer to variable in Client Script as below:
g_sc_form.getValue('<variable name>')
g_form.getValue('variables.<variable name>')
current is something that only exists server side (that is in ServiceNow's web server).
Client Scripts (Catalog Client Scripts too) exist client side (in the browser).
So correcting the current bit should get you closed to what you want.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2023 09:22 AM
Though for proper debugging and answer, it would be helpful to clarify if this is a Catalog Item, or a Record Producer and what is the target table in the latter case.