- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2016 12:35 PM
Hi All,
I have created a script include "taskDisplayFilter" to hide/show filter on the task table, I want to show/hide the filter based on the current view, but I am not able to get the current view name inside script include. Can you please help me out?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2016 02:20 PM
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();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2020 01:01 PM
Hello: I have a similar question. The code works for me when called when a form is loaded. What I'd like to do is use the view to restrict the records that appear when the list is loaded, but at that time the view does not appear to be populated. This is what I have in a before query business rule on alm_hardware. I'd appreciate any help.
(function executeRule(current, previous /*null when async*/) {
if (gs.getSession().isInteractive()) {
var map = gs.action.getGlideURI().getMap();
if (map.get('sysparm_view') != null) {
view_name= map.get('sysparm_view').toString();
}
if (view_name == 'XYZ') {
current.addQuery('install_status', '!=', 21);
// Unfortunately, this does not restrict the records shown in the list view (alm_hardware.list), which is what I'd like. It does restrict the records that can be accessed from the list view (when I click on a record with install_status equal to 21 I receive "Record not found").
}
})(current, previous);