How to hide a Module based on condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 10:55 PM
Hi All,
I have a custom Application.
Now I wanted to display modules based on some conditions.
For example, if the property glide.sys.domain.partitioning is enabled we need to show some modules. If it is disabled we need to show some other modules.
Is there anyone who can assist me in accomplishing this?
Best Regards,
Akil Prasath
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 10:59 PM
Hi @Akilprasath Cha ,
You can run a Query Business rule, here is an example based on Role :
https://www.servicenow.com/community/itsm-forum/hide-module-based-on-role/td-p/620653
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 11:51 PM
Hi Sandeep,
Since my Application is not under the Global scope. I am not able to create a before-query business rule.
Any thoughts on this?
Thanks,
Akil Prasath C
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 11:16 PM
Hi @Akilprasath Cha ,
You can write before query business rule on sys_app_module table
(function executeRule(current, previous /*null when async*/ ) {
if (gs.getProperty('get.value.hide') === 'true') {
current.addQuery('sys_id', '!=', 'b9169d55873212001ac119fa84e3ece3');//module sys_id
}
})(current, previous);
Please mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 11:51 PM
Hi Anand,
Since my Application is not under the Global scope. I am not able to create a before-query business rule.
Any thoughts on this?
Thanks,
Akil Prasath C