logo

NJP

How to move choices to another instance ?

Import · Apr 07, 2018 · article

Working without updateset becomes sometimes cumbersome. Specially when moving choice set to another distance. I am not sure if there is an easy way of doing this. But, I find this way quite easy to implement. An example would be the state field choices for incident table as follows.

image

When I work in the DEV environment with the new choices without updateset I have to export to excel and generate insert script and run the script in PROD environment but it is just wasting the time.

To get over this, I’ve developed some script and used in UI Context Menus.

imageimage

First of all, we need to create a table with a field which holds the generated script.

Let’s call it u_temporary as follows.

image

Scripts

In order to implement we need 3 scripts.

  1. UI Context Menu script
  2. Script Includes:
    1. Server side: GenerateInsert.js
    2. Client side: GenerateInsertAjax.js
    3. Server side: StringBuilder.js

Implementation

Let’s generate the insert statements for the state fields for incident table.

image

image

If we go to the link we get the result as follows. And run the script in another instance in Scripts – Background.

image

Scripts are attached.

Comments

  1. It doesn’t escape the “ character so doesn’t work with the field values that have “ character.
  2. You can generate insert statements for any table.
  3. Any comments are welcome.

Regards

Yusuf

View original source

https://www.servicenow.com/community/developer-articles/how-to-move-choices-to-another-instance/ta-p/2329849