- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2016 11:07 PM
Hello,
i want to get the view name on UI action(Server Side). is there any function for that ?
Regards,
Hima Pallela.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2016 11:38 PM
Hi Hima,
Try below code snippet.
var view_name='';
if (gs.getSession().isInteractive()) {
var map = gs.action.getGlideURI().getMap();
if (map.get('sysparm_view') != null) {
view_name= map.get('sysparm_view').toString();
}
}
gs.log('View: '+view_name);
Thanks,
Abhinandan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2016 11:28 PM
You may find this helpful !
http://wiki.servicenow.com/index.php?title=Restrict_Form_Views_by_Role#gsc.tab=0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2016 11:36 PM
Also what you can try:
- create a field which is hidden on the form ( let's say 'u_view')
- use this script to populate its value
g_form.setValue('u_view', getView());
- in your UI Action use it as 'current.u_view'

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2016 11:38 PM
Hi Hima,
Try below code snippet.
var view_name='';
if (gs.getSession().isInteractive()) {
var map = gs.action.getGlideURI().getMap();
if (map.get('sysparm_view') != null) {
view_name= map.get('sysparm_view').toString();
}
}
gs.log('View: '+view_name);
Thanks,
Abhinandan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2018 11:49 PM
Hi,
Can you please help me implementing same for a ui action condition. I want to add a specific condition, which displays ui action for specific view?
Thanks