Comparing version 1.0.2 to 1.0.3
@@ -56,3 +56,3 @@ import { request } from 'https'; | ||
query: encodedQuery, | ||
script: "var request = new sn_ws.RESTMessageV2();request.setEndpoint('https://"+ process.env.SOURCE_ENV + ".service-now.com/api/now/table/"+table+"?sysparm_exclude_reference_link=true&sysparm_query="+ encodedQuery+"');request.setHttpMethod('GET');var user = " + "'" + process.env.SOURCE_USERNAME + "'" + ";var password = " + "'" + process.env.SOURCE_PASSWORD + "'"+ ";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();}", | ||
script: "var request = new sn_ws.RESTMessageV2();request.setEndpoint('https://"+ process.env.SOURCE_ENV + ".service-now.com/api/now/table/"+table+"?sysparm_exclude_reference_link=true&sysparm_query="+ encodedQuery+"');request.setHttpMethod('GET');var user = " + "'" + process.env.SOURCE_USERNAME + "'" + ";var password = " + "'" + process.env.SOURCE_PASSWORD + "'"+ ";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('"+table+"');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();}", | ||
trigger_type: 0, | ||
@@ -59,0 +59,0 @@ next_action: '2000-07-12 12:34:02' |
{ | ||
"name": "snget", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "A utility to export & import ServiceNow records from one instance to another.", | ||
@@ -5,0 +5,0 @@ "main": "app.js", |
# snGet | ||
A utility to export & import ServiceNow records from one instance to another. | ||
## Setup | ||
## 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 | ||
## Setup from NPM | ||
1. ```npm i snget``` | ||
2. Rename or copy .env.example to .env | ||
3. Update the target and source variables as needed | ||
4. Run in the terminal ```node app.js``` | ||
5. Enter table: ```incident``` | ||
6. Enter encoded query: ```sys_id=A1234567890``` | ||
7. Check the target instance to make sure the records have inserted or updated based on your encoded query | ||
2. Move the snget folder out of node_modules and into the project root directory | ||
3. Move the node_modules folder into the snget folder | ||
4. Change to the snget directory in 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 | ||
_This is temporary until I publish a better solution for NPM_ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6037
28