Giter Club home page Giter Club logo

snget's Introduction

snget

A utility to export & import ServiceNow records from one instance to another.

Setup from ZIP file

  1. Download ZIP file
  2. Extract ZIP
  3. Open snget folder in VS Code
  4. npm i in integrated Terminal
  5. Rename or copy .env.example to .env
  6. Update the target and source variables as needed
  7. Run in the terminal node app.js
  8. Enter table: incident
  9. Enter encoded query: sys_id=A1234567890
  10. Check the target instance to make sure the records have inserted or updated based on your encoded query

Setup from GitHub

  1. Clone repo
  2. Browse to the repo directory in the terminal cd snget
  3. Install dotenv dependency using npm i
  4. Rename or copy .env.example to .env
  5. Update the target and source variables as needed
  6. Run in the terminal node app.js
  7. Enter table: incident
  8. Enter encoded query: sys_id=A1234567890
  9. Check the target instance to make sure the records have inserted or updated based on your encoded query

snget's People

Contributors

lvl0-io avatar

Stargazers

Jeffrey Hunt avatar  avatar  avatar

Watchers

 avatar

snget's Issues

Getting error for cmn_cost_center: org.mozilla.javascript.EvaluatorException: GlideRecord.get() - invalid table name: null

Works fine with table incident, but with table cmn_cost_center I get this error: (I xxx instance user and pw)

org.mozilla.javascript.EvaluatorException: GlideRecord.get() - invalid table name: null (sys_trigger.a723781b97c4f590a2037cf71153aff1; line 1)
EvaluatorException(JavaScript evaluation error on:
var request = new sn_ws.RESTMessageV2();request.setEndpoint('https://xxx.service-now.com/api/now/table/cmn_cost_center?sysparm_exclude_reference_link=true&sysparm_query=GOTOname%3E%3D503%5Eu_are_name%3DDI%5Eu_country%3Da08850a56ce8e1000ff5847661b85de7%5Ename%3D503');request.setHttpMethod('GET');var user = 'xxx';var password = 'xxx';request.setBasicAuth(user, password);request.setRequestHeader('Accept', 'application/json');var response = request.execute();var rec = JSON.parse(response.getBody());var results = rec['result'];for(var i = 0; i < results.length; i++){var newRec = new GlideRecord(results[i].sys_class_name);if (!newRec.get(results[i].sys_id.toString())) {newRec.sys_id = results[i].sys_id.toString();} else { gs.info(results[i].sys_id.toString());newRec.get(results[i].sys_id.toString());}for (key in results[i]) { newRec[key] = results[i][key].toString();}newRec.setWorkflow(false);newRec.autoSysFields(false);newRec.update();}
)

Getting error- Error: getaddrinfo ENOTFOUND undefined.service-now.com

Hi Michael.

I am not much aware of node.js. Could you please advise me here.

While running your utility on node.js, I am getting the following error.

C:\Users\HP\node_modules\snget>node app.js
Enter table: incident
Enter query: sys_id=a9f9958047543110a2851a8bd36d43b6
Error: Error: getaddrinfo ENOTFOUND undefined.service-now.com
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:108:26) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'undefined.service-now.com'
}

Have updated env file as below:

Copy or remove .example & update the values below

TARGET

TARGET_USERNAME="admin" #demo
TARGET_PASSWORD="****" #password1
TARGET_ENV="dev146420" #dev12345

SOURCE

SOURCE_USERNAME="admin" #demo
SOURCE_PASSWORD="****" #password1
SOURCE_ENV="dev169771" #prod12345

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.