logo

NJP

Provision your PDI or company/customer instances quicker, smarter (04): Applying Plugins

Import · Jun 01, 2020 · article

Plugins

There's are always some plugins you want to have activated on your Personal Developer Instance. For example a language plugin, some Performance Analytics content packs, Virtual Agent, etc.. Even if it's only one plugin, this could already take ages. For example activating the "I18N: Dutch Translations" plugin takes hours.

There is a way, to activate plugins through Server Side scripting. This is also an out-of-the-box used feature. For example have a look at Clone Cleanup Script "Install deactivated plugin". This uses the GlidePluginManager API.

Fix Script

Knowing the above, we might be able to come up with a Fix Script, to activate plugins in the background. For our example, let's go for plugins:- Glide Virtual Agent[com.glide.cs.chatbot]- Service Management Virtual Agent Topic Blocks [com.glideapp.cs.sm_topic_blocks]- Virtual Agent Analytics Dashboard [com.glide.cs.pa]

- I18N: Dutch Translations [com.snc.i18n.dutch]

A basic script could already be something like:

var pm = new GlidePluginManager();
pm.registerPlugin("com.glide.cs.chatbot");

Because we are about to apply multiple plugins, let's set up an Array to make the code a little bit more efficient. Also let's wrap the code in a function, which you always should.

(function() {

    var pluginArr = [
        "com.glide.cs.chatbot",
        "com.glideapp.cs.sm_topic_blocks",
        "com.glide.cs.pa",
        "com.snc.i18n.dutch"
    ];

    for(i = 0; i < pluginArr.length; i++) {
        var pm = new GlidePluginManager();
        pm.registerPlugin(pluginArr[i]);
    }

})();

Result

After running the Fix Script in the background, the plugins are getting activated. Some might just take seconds or a few minutes to finish. Some like the language plugins can take hours to finish. Just check the plugins list for the latest status of the installation.

Though this way, you don't have to wait for each plugin to finish, apply the next one manually, etc..

A short Fix Script, though a real time saver! Obviously you could also choose a different method, for example like a Scheduled Job which would execute this for you.

Applying Utilities

We made another nice step in provisioning your PDI or company/customer non-production instance with applying your Plugins. Next-up: Applying Utilities.

Keep an eye out for the next blog where I'll write about applying your favorite utilities rapidly!

---

If any questions or remarks, let me know!

Kind regards,

Mar k Roethof

ServiceNow Technical Consultant @ Quint Technology

1x ServiceNow Developer MVP

1x ServiceNow Community MVP

---

LinkedIn

View original source

https://www.servicenow.com/community/developer-blog/provision-your-pdi-or-company-customer-instances-quicker-smarter/ba-p/2268118