One of the ongoing issues that we deal with in the Developer Program is the continuity of the free Personal Developer Instances (PDI). No matter how well intentioned you are, it is always possible to have a time period where you are out of the office and miss the email about your Developer Instance expiring. I don’t like the idea of anyone losing their work but there is only so much we can do to prevent it. There aren’t enough resources to give developers free instances that last forever, so we do the best we can.
However, you as the developer have the ability to mitigate this. If you have a backup of everything important to you, then losing your instance is a trivial operation. You request another, reinstall from backup and proceed ahead.
There are multiple ways to backup your instance nowadays. Below we go over three ways in-depth:
Table of contents
- How to backup your PDI with Studio
- How to backup your PDI with App Engine Studio
- How to backup your PDI with update sets
How to backup your PDI with Studio
Intro
This section explains how to backup your PDI using Studio (not to be confused with App Engine Studio). This is important information to know because you should always be storing your backups in an external location outside of your PDI.
Preparation work
You will only have to do the following preparation work once.
GitHub
To back up your scoped application using Studio, you will need a version control system called Git. The most popular one is GitHub, which we will be using in this walkthrough.
Sign up for GitHub
Go to https://github.com/ and enter your email address and click Sign up for Github
and follow the instructions
Create a personal developer token
GitHub requires personal access tokens to access repositories from other platforms, like ServiceNow. A personal access token is used in place of a password when authenticating.
To create a personal access token:
- Use the GitHub instructions to create a personal access token to use with ServiceNow.
- Configure the New personal access token.
- Note: ServiceNow access
- Expiration: No expiration
- Select scopes: repo
- Copy your token to keep in a secure location. (This is the only time it will ever be revealed, if you don’t save it now, you’ll have to create a new one).
ServiceNow Credential
Now that you have a GitHub account and Personal Access Token. Let’s create a credential record in ServiceNow:
- In your filter navigator, navigate to
Connections & Credentials
>Credentials
- On the Credentials table, click
New
to create a new credential record - You will be asked “What type of Credentials would you like to create?” Choose
Basic Auth Credentials
- Configure the New Basic Auth Credentials record.
- Name: GitHub Personal Access Token for [your name]
- User name: your GitHub account’s user name
- Password: Your Personal Access Token (not your GitHub account password)
- Submit the record
Save your apps to GitHub via Studio
Whenever you want to save your scoped-app work to GitHub, follow these steps for every app:
Create a new repository on GitHub
- Go to https://github.com/ and login
- On the top right, click the
+
button and selectNew repository
- Under “Repository name” give it a name that matches the ServiceNow app you want to backup
- Click
Create repository
- Once created note the URL of your repository, it should look like
https://github.com/yourusername/your-app-name
Save your app to the new repo
- In your filter navigator, navigate to
System Applications
>Studio
- In the “Select Application” window, click on the Application that you want to backup
- Once your application is loaded, click on the
Source Control
header menu item and selectLink To Source Control
- Configure the Link
- URL: The repository URL from earlier
- Credential: The credential record you created earlier
- Branch: Leave this as is
- Click on
Link To Source Control
That’s it! You can go back to your repo URL and verify that your files have been saved on GitHub
Reminders
- Never save passwords, secret tokens, or other sensitive information in a public Git repository!
- Metadata is not saved, only configuration/application files. For example, a business rule on the Incident table is saved, but incident records on the Incident table are not. Need to backup data, too?
- Go to the list view of your table
- Select the records you want to backup
- Select the
Create Application File
list action - Select
OK
Importing your repository back onto your ServiceNow instance
If you need to bring your work back into ServiceNow from GitHub, follow these steps:
- In your filter navigator, navigate to
System Applications
>Studio
- In the “Select Application” window, click on
Import From Source Control
- Configure the Import
- URL: The repository URL you want to import
- Credential: The credential record you created earlier
- Branch: The branch name when you first saved your work to GitHub. Don’t remember? See below
- Click on
Import
Forgot your Branch name?
- Go to your repository on GitHub
- On the
Code
tab, look for the item that saysbranches
and click on it - Find the branch that you made, it should look like:
sn_instances/[your_instance_name]
That’s it! All your work should be back.
How to backup your PDI with App Engine Studio
Intro
This section explains how to backup your PDI using AES (App Engine Studio, not to be confused with Studio). This is important information to know because you should always be storing your backups in an external location outside of your PDI.
Preparation work
You will only have to do the following preparation work once.
GitHub
To back up your scoped application using Studio, you will need a version control system called Git. The most popular one is GitHub, which we will be using in this walkthrough.
Sign up for GitHub
Go to https://github.com/ and enter your email address and click Sign up for Github
and follow the instructions
Create a personal developer token
GitHub requires personal access tokens to access repositories from other platforms, like ServiceNow. A personal access token is used in place of a password when authenticating.
To create a personal access token:
- Use the GitHub instructions to create a personal access token to use with ServiceNow.
- Configure the New personal access token.
- Note: ServiceNow access
- Expiration: No expiration
- Select scopes: repo
- Copy your token to keep in a secure location. (This is the only time it will ever be revealed, if you don’t save it now, you’ll have to create a new one).
ServiceNow Credential
Now that you have a GitHub account and Personal Access Token. Let’s create a credential record in ServiceNow:
- In your filter navigator, navigate to
Connections & Credentials
>Credentials
- On the Credentials table, click
New
to create a new credential record - You will be asked “What type of Credentials would you like to create?” Choose
Basic Auth Credentials
- Configure the New Basic Auth Credentials record.
- Name: GitHub Personal Access Token for [your name]
- User name: your GitHub account’s user name
- Password: Your Personal Access Token (not your GitHub account password)
- Submit the record
Save your apps to GitHub via AES
Whenever you want to save your scoped-app work to GitHub, follow these steps for every app:
Create a new repository on GitHub
- Go to https://github.com/ and login
- On the top right, click the
+
button and selectNew repository
- Under “Repository name” give it a name that matches the ServiceNow app you want to backup
- Click
Create repository
- Once created note the URL of your repository, it should look like
https://github.com/yourusername/your-app-name
Save your app to the new repo
- In your filter navigator, navigate to
App Engine
>App Engine Studio
- Click on the
MY APPS
tab, and then click on the Application that you want to backup - Once your application is loaded, in the top-right click on the
Source Control
drop down menu and selectLink to source control
- Configure the Link
- URL: The repository URL from earlier
- Branch: Leave this as is
- Credential: The credential record you created earlier
- Click on
Link to source control
That’s it! You can go back to your repo URL and verify that your files have been saved on GitHub
Reminders
- Never save passwords, secret tokens, or other sensitive information in a public Git repository!
- Metadata is not saved, only configuration/application files. For example, a business rule on the Incident table is saved, but incident records on the Incident table are not. Need to backup data, too?
- Go to the list view of your table
- Select the records you want to backup
- Select the
Create Application File
list action - Select
OK
Importing your repository back onto your ServiceNow instance
If you need to bring your work back into ServiceNow from GitHub, follow these steps:
- In your filter navigator, navigate to
App Engine
>App Engine Studio
- Click
Import app
- Configure the Import
- URL: The repository URL you want to import
- Branch: The branch name when you first saved your work to GitHub. Don’t remember? See below
- Credential: The credential record you created earlier
- Click on
Import app
Forgot your Branch name?
- Go to your repository on GitHub
- On the
Code
tab, look for the item that saysbranches
and click on it - Find the branch that you made, it should look like:
sn_instances/[your_instance_name]
That’s it! All your work should be back.
How to backup your PDI with update sets
Intro
This section explains how to backup your PDI using update sets. This is important information to know because you should always be storing your backups in an external location outside of your PDI.
Working in update sets
Any work that you want to be saved and backed up should be in update sets!
- Navigate to
System Update Sets
>Local Update Sets
and clickNew
. - Complete the form from the fields in the table.
- Click Submit to create the update set. If the picker is enabled and the update set is in the In progress state, click Submit and Make Current to select the new update set as the target for configuration changes.
What does this mean? Now that an update set is “current”, any configuration work you perform will automatically be recorded in this update set. When you think your work is done, set it to “complete” and now it’s ready for exporting.
Note that Metadata is not saved, only configuration/application files. For example, a business rule on the Incident table is saved, but incident records on the Incident table are not. Need to backup data, too?
1. Go to the list view of your table
2. Select the records you want to backup
3. Select the Create Application File
list action
4. Select OK
Exporting update sets
The process is a little different depending on if you’re trying to backup individual update sets, several update sets at the same time, or if you’re trying to back up scoped applications via update set.
Exporting an individual update set
An individual update set has no “parent”
- Navigate to
System Update Sets
>Local Update Sets
and select the update set you want to export - Set the State to
Complete
and save the record (if not already done) - In the Update Set form, under
Related Links
selectExport to XML
- Save the XML file to your computer and/or upload to a cloud service
Exporting several update sets together
Do you have several update sets and need to export them together quickly?
- Create a new update set and note the name that you select for it
- Navigate to
System Update Sets
>Local Update Sets
- For all the update sets you want to export:
- Set their state as
Complete
, you can do this from the list view but double clicking on the State value for each desired row. - Set their parent as the update set you created in step 1, you can double click the “(empty)” here too to edit it in list view
- Set their state as
- Open the record for the update set you made in step 1
- Set the State to
Complete
and save the record (if not already done) - In the Update Set form, under
Related Links
selectExport Update Set Batch to XML
- Save the XML file to your computer and/or upload to a cloud service
Exporting a scoped application via update set
If you need to export an entire application (not just an update set within the application).
- Navigate to
System Applications
>My Company Applications
- Click on the application that you want to backup (click on the box itself, not the “Edit in Studio” button)
- If the top of your screen says “The [your app name] application cannot be changed because [another app name] is selected in your application picker” Click on
Switch to [your app name]
- Under
Related Links
selectPublish to Update Set...
- In the “Publish to Update Set” window, select
Publish
- Once the new update set is automatically created and loaded, under
Related Links
selectExport to XML
- Save the XML file to your computer and/or upload to a cloud service
Importing your update set back into ServiceNow
If you need to bring your work back into ServiceNow, follow these steps:
- Navigate to
System Update Sets
>Retrieved Update Sets
- Under
Related Links
selectImport Update Set from XML
- On the Import XML screen, select
Choose File
and select the XML file you exported from before. - Click
Upload
- Open the record for the update set you just imported
- Click on
Preview Update Set
- Click on
Commit Update Set
That’s it! All your work should be back.
Share this post
Twitter
Facebook
Reddit
LinkedIn
Email