How to hide a Module based on condition

Akilprasath Cha
Tera Contributor

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

4 REPLIES 4

Community Alums
Not applicable

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

 

Hi Sandeep,

 

Since my Application is not under the Global scope. I am not able to create a before-query business rule.

 

AkilprasathCha_0-1701244255510.png

 

Any thoughts on this?

 

Thanks,

Akil Prasath C

 

Anand Kumar P
Giga Patron
Giga Patron

Hi @Akilprasath Cha ,

You can write before query business rule on sys_app_module table 

AnandKumarP_0-1701242045001.png

 

AnandKumarP_1-1701242065251.png

 

(function executeRule(current, previous /*null when async*/ ) {

    if (gs.getProperty('get.value.hide') === 'true') {
        current.addQuery('sys_id', '!=', 'b9169d55873212001ac119fa84e3ece3');//module sys_id
    }


})(current, previous);

AnandKumarP_2-1701242102967.png


Please mark it as helpful and solution proposed if it serves your purpose.

Thanks,

Anand

Hi Anand,

 

Since my Application is not under the Global scope. I am not able to create a before-query business rule.

 

AkilprasathCha_0-1701244255510.png

 

Any thoughts on this?

 

Thanks,

Akil Prasath C