fbpx
1-888-310-4540 (main) / 1-888-707-6150 (support) info@spkaa.com
Select Page

Electric Commander (Now CloudBees CD) Transferring Homepage Settings Between Users

windchill features best plm software
Written by Carlos Almeida
Published on April 21, 2015

The Electric Commander homepage allows you to bookmark links and job configurations for easy access. It’s easy to add one or two, but if you have a lot of links and you want to share them with other users so that they have the same links as well, its a lot of work to do manually one at a time.

In this video, I demonstrate the technique for copying these settings between users and provide a script that users can download and install as a Commander plugin.

Video Transcript:

Let’s say that you have your (Electric) Commander home page set up exactly the way you want it. You’ve got links all your important places both in and outside of commander and you’ve got your job configuration set up to launch your jobs at the push of a button. Adding one or two links your setup isn’t a big deal but suppose you want to replicate all of your settings in another user’s account or worse suppose you decide you want to share your settings with an entire team. Manually recreating a set of links of any substantial size would take forever. So what do you do? First you need to know that these home page settings are stored as properties under your user name. If you pull up your user object to the web UI and run browse to the user settings property sheet you’ll see the two property sheets were interested in: Job configurations and Shortcuts. Under each property sheet is a set of further property sheets describing the links. What will be nice is to be able to use easy tools clone method to copy one users job configurations or shortcuts property sheet over to another users but unfortunately it won’t work. Clone won’t overwrite properties that already exist and even if the target user doesn’t have any job configs or shortcuts to find those property sheets are present already. The other problem is that we really don’t want to erase any settings the target user may already have defined. We want to add to their home page and not replace it. This means we have to clone each the individual entries under these property sheets for every user we want to update. So what we do is create a short script to clone each job config or shortcut individually for a given set of users. I created a working example as a commander procedure. Let’s take a look. First, note that i have three parameters: from user, to users and user settings to copy. “From user” is a simple text field where you enter a single user name from which all the settings will be copied. “To users” is a text area field that allows you to enter a new line separated list of usernames to which you would like to copy the settings. And “user setting to copy” is a radius selection that allows you to choose the setting to copy.

Now let’s look at the procedure itself. Taking a look at the procedure, we see that we have our standard easy pearl heading for a job step command. We instantiate a commander object and we store the parameters we’ve passed in. Then we execute a get properties request for the particular setting we’re interested in and use the “get setting names” sub procedure to collect the names of the properties that define each of the custom settings. Finally, for each target user we iterate over the list of settings and clone each one from the source user to the target user. The call to clone itself is enclosed in an eval block because even if the clone operation fails for some reason we want to keep going and not end up in some odd state in which half the target users don’t have the settings applied because the step failed on one operation. Instead we record which transaction failed in the log and use post p to display the number of failed transactions in the job step summary. Then you can go back later and resolve any issues individually. If we run the procedure entering admin as the “from user”, the set of 20 users recreated as the “to users” and choose shortcuts as “the setting the copy”, we see that the procedure executes. And if we login as one of these new users, they will have the same set of shortcuts as admin. If you’d like to use the procedure or modify it for some other purpose I’ve converted this project into a plug-in and have the jar available for download. Simply import and promote the plug-in jar file and a project name “SPK Utilities” will be created that contains this procedure.

Latest White Papers

2023 Global DevSecOps Report

2023 Global DevSecOps Report

Productivity and efficiency are top priorities for many organizations, as seen from the 2023 Global DevSecOps Report. It is no coincidence these two priorities are also the driving forces of DevOps. Explore how businesses utilized DevOps practices to achieve success...

Related Resources

How SaaS is Transforming Manufacturing

How SaaS is Transforming Manufacturing

Whether you are in the tech industry or not, you’ve likely heard the term, Software-as-a-Service (SaaS).  SaaS is making a shift from being optional, to essential for many businesses due to the flexibility, security, scalability, and improved collaboration it...