How to hide a tab if a plugin is not present

Jyotshna_M
ServiceNow Employee
ServiceNow Employee

I have added a tab to macroponent which I wanted to hide when customer_central plugin is absent.

 

one approach to add this is add macroponent definition in the if folder when plugin is present.

 

wanted to check if some other way exists where i can check if plugin is present in client script and show/hide depending on the value returned 

1 ACCEPTED SOLUTION

Chaitanya ILCR
Kilo Patron

Hi @Jyotshna_M ,

you can use GlidePluginManger API to check if the plugin is active or not.

create a Client Callable Script include which checks the plugin is active or not and use GlideAjax to check if the plugin active

ChaitanyaILCR_0-1740930840615.pngChaitanyaILCR_1-1740930874133.png

 


https://www.servicenow.com/docs/bundle/xanadu-api-reference/page/app-store/dev_portal/API_reference/...

 

Script

 

var testPluginUtils = Class.create();
testPluginUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
    isPluginActive: function() {

        var a = new GlidePluginManager();
        return a.isActive('put.your.plugin.id.here');
    },
    type: 'testPluginUtils'
});

 

 

Client Script 

 

var ga = new GlideAjax('testPluginUtils')
ga.addParam('sysparm_name', 'isPluginActive')
ga.addParam('sysparm_plugin_id', 'sn_sns')
ga.getXMLAnswer(function(ans) {
    if (ans == 'false') {
        g_form.setSectionDisplay('your_section_name', false)
    }
})

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

View solution in original post

1 REPLY 1

Chaitanya ILCR
Kilo Patron

Hi @Jyotshna_M ,

you can use GlidePluginManger API to check if the plugin is active or not.

create a Client Callable Script include which checks the plugin is active or not and use GlideAjax to check if the plugin active

ChaitanyaILCR_0-1740930840615.pngChaitanyaILCR_1-1740930874133.png

 


https://www.servicenow.com/docs/bundle/xanadu-api-reference/page/app-store/dev_portal/API_reference/...

 

Script

 

var testPluginUtils = Class.create();
testPluginUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
    isPluginActive: function() {

        var a = new GlidePluginManager();
        return a.isActive('put.your.plugin.id.here');
    },
    type: 'testPluginUtils'
});

 

 

Client Script 

 

var ga = new GlideAjax('testPluginUtils')
ga.addParam('sysparm_name', 'isPluginActive')
ga.addParam('sysparm_plugin_id', 'sn_sns')
ga.getXMLAnswer(function(ans) {
    if (ans == 'false') {
        g_form.setSectionDisplay('your_section_name', false)
    }
})

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya