NOTE: MY POSTINGS REFLECT MY OWN VIEWS AND DO NOT NECESSARILY REPRESENT THE VIEWS OF MY EMPLOYER, ACCENTURE.
DIFFICULTY LEVEL: INTERMEDIATE
Assumes basic knowledge and/or familiarity of the Studio IDE in ServiceNow.
A short time ago I had need of changing my repository URL for one of my projects in the Studio IDE, and much to my surprise found that I was not allowed to do it! The URL field was read-only!?! Off to the ServiceNow documentation site I went. However, no solution was published there. I promptly went to the Community to find out if this had been mentioned by anyone else. Sure enough, the question was asked, and ctomasi was able to get an answer (How do you edit/remove a source control repository?). But the answer there bothered me. 1) it was a work-around, 2) you lost all historical information with the work-around. After my third project re-point, using this method, I began looking around for the best way to hack it (I was that unhappy). I began investigating all the pieces I could find concerning where the URL might be located, and what I would have to write in the way of a Fix Script to do the actual hack.
Well, sometimes the complex way is NOT the solution!
While messing around looking at tables and their interactions I tripped across a method for doing this that looks like it was intentional; sic. out-of-the-box. It was too easy. This method does not hang onto the Source Control Branch or Source Control Tags (a minor loss to me), but just so you are warned.
This article explains how to change the URL using that method.
So WHY would you want to change the URL in the first place? Here are some use-cases I can think of just off the top of my head:
- Changing from a personal repository to a corporate repository. My original reason for changing the URL.
- Reorganization of the repository's directory structure requires changing of the Studio url. This is probably the most important.
- Unbinding source control from the Studio project.
- Changing the repository provider. Let's say from GitLab to GitHub or the reverse.
And I am sure there are more.
BEST PRACTICE: First make a backup of your entire project to an Update Set
1. Navigate to System Applications -> Applications. The Applications list view will be displayed.
2. Click on the link to your Studio Application. This will display the Custom Application properties form.
3. Change the Current Application setting to be the application you are working with. This will activate the Related Links on the form.
4. Scroll down the form to view the related links and click on the Publish to Update Set… link. The Publish to Update Set
5. Fill in the form:
Version: <<keep what was displayed>>
Description: Repoint to new repository.
Click on the Publish button.
6. Wait for the Progress bar to complete and click the Done button. The new update set will be displayed.
7. Under Related Links click the Export to XML button. This will save a copy of the entire project to your local disk. You might want to rename this with your Application name and version just to be safe.
To Clear out the Repository URL For an Application
Now, on to the good stuff!
1. Navigate to sys_repo_branch.list. The Source Control Branches list view will be displayed.
2. Find the Application you wish to reset the repository URL for, and open that record. The Source Control Branch form will be displayed.
3. Click on the Repository Configuration link button. The Repository Configuration Record will be displayed.
4. Click on the Delete button in the upper right corner of the form. The Confirmation form will appear.
5. Click on the delete button.
6. A “Record Not Found” message will be displayed. Ignore this, and go back to the Studio to open your application.
7. This clears out the repository URL and information for the Application. You may now use the normal linking of a repository procedure inside of Studio; to point at your new URL.
And there you go! An out-of-the-box method for clearing and/or changing the repository URL for ServiceNow Studio. Maybe in a future release we will get a menu-item or editable URL field inside the Studio to do this, but until then this is the best way.
Please Share, Like, Bookmark, Mark Helpful, or Comment this blog if you've found it helpful or insightful.
Also, if you are not already, I would like to encourage you to become a member of our blog!