- 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
‎09-25-2024 08:06 AM
var gURI = new GlideURI();
var viewName = gURI.get('sysparm_view');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2016 02:27 PM
OR
gs.action.getGlideURI().get('sysparm_view') == 'my_view';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2017 12:12 AM
There might be the issue with gs.action.getGlideURI().getMap().get('sysparm_view'); in Istanbul release
We can get the view name in business by just using 'view' because 'view' is a global variable that holds the current form view.
Eg:
On 'Display' type Business rule at TOP domain mention in script as,
if(view=='ess' && !current.isNewRecord()){
DO YOUR ACTION!!!
}
Please Hit Like/Helpful based on the response, so that it may help others to quickly find a solution for related issue
Regards,
Rishi

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2020 11:49 PM
Hey.
"We can get the view name in business by just using 'view' because 'view' is a global variable ..." - where comes that from?
Unfortunately this seems not to be the case ;-(
I'm currently looking to get the view on a on before business rule without using gs.action.getGlideURI().getMap().get('sysparm_view') due to issues that comes with it.
Any idea?
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2022 11:33 PM
Hello,
The following code seems to be working in San-Diego:
var view;
if (gs.getSession().isInteractive()) {
var map = gs.action.getGlideURI().getMap();
 if (map.get('sysparm_form_view') !=null)
  view = map.get('sysparm_form_view').toString();
}
gs.info('view = ' + view);