- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2017 02:53 AM
I have default filters defined in my affected ci's related list but i dont want those filters to be visible to my users. How can i achieve that??
I want this filter to be hidden. Kindly help me to achieve this
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2017 03:54 AM
Ok. I don't think there is any OOB method available for hiding that filter. I achieved this by using DOM, Please write a UI Script as mentioned below:
Scenario:
For example on the Change form we have the Problem Related List, so I am hiding the filter on the Problem Related List only present on the Change form for all the Users except the Admins.
Script:
try {
var loc = window.location.href;
if((loc.indexOf('sys_target=problem')>0) && loc.indexOf('sysparm_collection=change_request')>0) //this would only hide for Problem & Change combo
{
setTimeout(setMyFilter, 1000);
function setMyFilter()
{
if(!g_user.hasRole('admin')) //This will allow to hide for all except Admins
{
document.getElementsByClassName('col-sm-offset-2 col-sm-8 m2m_filter_container')[0].style.display='none';
}
}
}
}
catch (e) {
}
Make Sure "Global" checkbox on the UI Script form is marked as True as highlighted above.
Result:
Hope this helps.Mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2017 03:42 AM
yes shloke exactly dat one only!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2017 03:54 AM
Ok. I don't think there is any OOB method available for hiding that filter. I achieved this by using DOM, Please write a UI Script as mentioned below:
Scenario:
For example on the Change form we have the Problem Related List, so I am hiding the filter on the Problem Related List only present on the Change form for all the Users except the Admins.
Script:
try {
var loc = window.location.href;
if((loc.indexOf('sys_target=problem')>0) && loc.indexOf('sysparm_collection=change_request')>0) //this would only hide for Problem & Change combo
{
setTimeout(setMyFilter, 1000);
function setMyFilter()
{
if(!g_user.hasRole('admin')) //This will allow to hide for all except Admins
{
document.getElementsByClassName('col-sm-offset-2 col-sm-8 m2m_filter_container')[0].style.display='none';
}
}
}
}
catch (e) {
}
Make Sure "Global" checkbox on the UI Script form is marked as True as highlighted above.
Result:
Hope this helps.Mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2017 04:15 AM
Hi Shloke,
can u plz make me explain what does these lines actually do ?? How does this line hides the filter
document.getElementsByClassName('col-sm-offset-2 col-sm-8 m2m_filter_container')[0].style.display='none';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2017 04:32 AM
Hi,
Basically, this is a DOM Method by which we are retrieving all the Elements for the particular Class mentioned in the bracket (col-sm-offset-2 col-sm-8 m2m_filter_container) of the filter which is getting displayed above the slush bucket after click on the Edit button and style.display='none' is a CSS property to hide those elements.
Please refer the link below for more Details on DOM for ClassName method:
HTML DOM getElementsByClassName() Method
Hope this helps.Mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2017 06:14 AM
Thanks sloke...it was spot on..