- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2016 09:54 PM
Hi,
I have a requirement to hide a specific module based on one of the field on the user table. Initially I thought to create a role, assign that role to the module and add all the filtered users to the role but this is not a perfect solution since the field on the user form can be updated at any time.
For e.g. : I want to hide 'My Asset' module if the users department is either 'India' or 'England'.
Does anybody have any ideas to meet this requirement?
Regards,
Srini
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2016 11:11 PM
Hi
Sorry, Mistake in last reply. In addquery it will be the sysid of the module that you want to hide.Please put sysid of module that you want to hide in addQuery
current.addQuery('sys_id', '!=', 'ec84ca0cdbfa620075d372ffbf9619cc'); //sysid of the module that you want to hide.
var qc1 = current.addQuery('title', '!=', 'My Profile');// this is not required.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2016 10:45 PM
Hi Harsh,
I have written something similar to that but it is not working. Can you check the code and let me know if I am missing something?
(function executeRule(current, previous /*null when async*/) {
var u = gs.getUserID();
var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id',u);
gr.query();
if(gr.next())
{
gs.addInfoMessage(gr.title);
if (gr.title != 'ServiceNow')
{
var qc = current.addQuery('sys_id', '!=', 'ec84ca0cdbfa620075d372ffbf9619cc');
var qc1 = current.addQuery('title', '!=', 'My Profile');
}
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2016 11:11 PM
Hi
Sorry, Mistake in last reply. In addquery it will be the sysid of the module that you want to hide.Please put sysid of module that you want to hide in addQuery
current.addQuery('sys_id', '!=', 'ec84ca0cdbfa620075d372ffbf9619cc'); //sysid of the module that you want to hide.
var qc1 = current.addQuery('title', '!=', 'My Profile');// this is not required.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2016 11:51 PM
It worked on regular servicenow instance but not on ESS portal. Where to include this script for ESS portal modules?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2016 12:22 AM
Please send me the screenshot of you ESS Page.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2018 03:57 AM
Hi,
post kingston, this doesnt work as expected. do you have any other idea for this ?
Thanks
Girish Deshpande