We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Mark Roethof
Tera Patron

Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

 

Hi there,

 

So you are about to reset your PDI? Or requesting a new PDI? Logging in for the first time on your fresh instance, and… darn, I have to set up all kinds of settings, personal preferences, utilities, etc. all over again! Can we somehow get those settings, personal preferences, utilities back on the fresh PDI? How can we start quicker with a slightly personal provisioned PDI?

 

I'm writing a few short Community Blogs on this topic. To share with you, how I tend to provision my PDI quicker.

Some of these ideas could also apply for company/customer instances. For example, if you are working as a consultant you will be faced with several companies, new instances every year. Yes, also on these instances you can get a head start!

 

The topics which I'm going to share in the upcoming days:
Setting-up your personal user account
Recommended System Properties and User Preferences
- Favorite Favorites
- Applying Plugins
Applying Utilities


Applying Plugins

In the previous three blogs we've set up a personal user account and a Fix Script to add Personalized Lists, recommended System Properties and User Preferences and our favorite Favorites. Another really annoying and very time consuming one… applying plugins all over again!

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!

 

C

If this content helped you, I would appreciate it if you hit bookmark or mark it as helpful.

 

Interested in more Articles, Blogs, Videos, Podcasts, Share projects I shared/participated in?
- Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

 

Kind regards,


Mark Roethof

ServiceNow Technical Consultant @ Quint Technology

1x ServiceNow Developer MVP

1x ServiceNow Community MVP

---

LinkedIn

 

6 Comments
Maik Skoddow
Tera Patron

Hi @Mark Roethof 

do you know a way to specify, that also demo data should be loaded when installing a plugin via script?

Many thanks
Maik

Mark Roethof
Tera Patron

Unfortunately no. This is also really in the undocumented area of ServiceNow. GlidePluginManager and GlideMultiPluginManagerWorker are hardly mentioned on the Docs/Developer site, while searching your instance or google you will find some functions, though except one: all undocumented. And unfortunatley, haven't seen a function for demo data or something.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020, 2021 ServiceNow Community MVP
2020, 2021 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

Joel L
ServiceNow Employee

There has been found a setting that applies this. See Activate plugin via script / automatically and ist discussion. I had the similar question around it.

Joel L
ServiceNow Employee

Hello Mark,

surfing different community entries, as also mentioned below I found a script mentioning more settings, that you might want to incorporate into your entry because, like me, the community will find your posts earlier than the other discussion thread Activate plugin via script / automatically

// the object you use, which i cannot check the outcome nor install demo data
var pm = new GlidePluginManager();
pm.registerPlugin(pluginArr[i]);

while the script and solutions by Ashby and Ingimar linking to Install Base PDI Plugins script on GitHub use another object: 

// the other object they used, which allows tracking via baseurl/sys_execution_tracker.do and install demo data
var main = new GlideMultiPluginManagerWorker();
main.setPluginIds(plugins); // Array of plugins
main.setIncludeDemoData(true); // True or False for all plugins
//main.setLoadDemoDataOnly(true); // Can be used to install demo data after installation of plugins.
main.setProgressName("Plugin Installer");
main.setBackground(true);
main.start();

I also wonder how we could address to SN that it seems quite a bunch of developers would have loved to just see this documented within the API docs.

Tony102
Mega Contributor

I found this undocumented method loadDemoData from this webpage: Workaround to install demo data if application is already installed

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

 

Sandesh Kobal
ServiceNow Employee

Does 'GlideMultiPluginManagerWorker' install plugin one by one or starts install in all of them at once?