logo

NJP

Provision your PDI or company/customer instances quicker, smarter (01): Setting-up your personal user account

Import · May 21, 2020 · article

Setting-up your personal user account

It's a best practice to work under a personal user account. Not only on company/customer non-production instances, also on your PDI. How often questions on the ServiceNow Community are posted, about having lost the admin role or turned on the Web service access only? This would not be an issue if you were working under a personal user account, instead of the System Administrator.

When working on a company/customer non-production instances, an administrator would probably set up your user record. Though your PDI, you have to set up this yourself. Sure, only a few minutes work. Though can we save this few minutes work, and this few minutes work quickly becomes more than few minutes. I tend to reset my PDI ever 3 months for example, so every 3 months, I have to do this over again. And how can we assure your user record is always exactly the same?

Template user record

What I did, is set up a template user record created through background script, manually set the password and added the user record to an Update Set. Obviously you could also use an XML for this, or a Fix Script. That's up to you. Nothing more actually! Fun fact: you could add a custom sys_created_on date/time. I added my birthday to the sys_created_on, 1983-05-01 14:30:00 image.

I've created the user record with the below script.

var grUser = new GlideRecord('sys_user');
grUser.initialize();
grUser.setValue('user_name', 'mark.roethof');
grUser.setValue('first_name', 'Mark');
grUser.setValue('last_name', 'Roethof');
grUser.setValue('preferred_language', 'en');
grUser.setValue('time_zone', 'Europe/Amsterdam');
grUser.setValue('date_format', 'dd-MM-yyyy');
grUser.setValue('sys_created_on', '1983-05-01 12:30:00');
grUser.setNewGuidValue('mark.roethof');
grUser.autoSysFields();
grUser.insert();

Recommended System Properties and User Preferences

Oke, this is not shocking yet and would only save one or two minutes every time you would reset your PDI. The next step which would create more time saving (and consistency) would be to add recommended System Properties and User Preferences to the Update Set / XML / Fix Script.

Keep an eye out for the next blog where I'll write about the System Properties and User Preferences affected!

---

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/2288041