Applying Client Script to sys_popup view
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2015 04:50 AM
I am trying to apply a client script to a sys_popup view that will stop an embedded list from being displayed if a user does not have the required role.
The client script I am using thanks to Mark Stanger is (http://www.servicenowguru.com/scripting/client-scripts-scripting/hiding-related-lists-embedded-lists...)
The script is working perfectly on "default view" when applied on a Global basis, but has no effect on the "sys_popup" view.
I have tried creating a non global copy of the client script, specifying the view as "Sys_popup", but no luck.
The client script is running onLoad.
I was wandering if it may not be working due to the nature of the "sys_popup" view, when it is displayed from the hover over, is it actually loading? (would/should it trigger an onLoad client script)
Any help or thoughts would be appreciated
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2015 06:10 AM
Unfortunately, as far as I know, the reference icon hover over popup does not run client scripts when the popup generates. A possible workaround might be to remove the field in question from the sys_popup view and add the dot-walked field to your form. Then you can run your client script on the current form and hide the field for your subset of users who shouldn't see it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2015 02:07 AM
That was my suspicion.
As there are multiple records available on the embedded list it can't be displayed in a single reference field.
The solution was to reduce the limitations of who can view the information, by adding an additional role to the read ACLs I no longer needed to hide the information.
Not an ideal solution as ess users without roles still have the records removed due to security restraints, but the people who require the information can see it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2016 09:37 AM
As Brad said you can't run ServiceNow client scripts when hover over, but you could execute a script in the client when showing the Sys_popup view if you load it from a UI Macro using a formatter. The inconvenient is, as it's not a Servicenow Client Script, you won't have access to g_form, but of course you could always load it: window.g_form = new GlideForm('sys_script',true,true,true,true);