Skip to content

Commit 7dd74b5

Browse files
authored
Fix script to unsync CI from Asset (#2430)
* Create script.js * Create readme.md
1 parent aa3dbf7 commit 7dd74b5

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix script to unsync a Asset from a CI . OOB the field is read only, this allows admin to unsync when required.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
unsyncCI();
2+
3+
function unsyncCI() {
4+
5+
var grAsset = new GlideRecord("alm_hardware");
6+
grAsset.addEncodedQuery('sys_id='); //replace query with rrequired list
7+
grAsset.query();
8+
if (grAsset.next()) {
9+
var grCI = new GlideRecord("cmdb_ci");
10+
grCI.addQuery("sys_id", grAsset.ci);
11+
grCI.setLimit(1);
12+
grCI.query();
13+
if (grCI.next()) {
14+
grCI.asset = '';
15+
grCI.setWorkFlow(false);
16+
grCI.update();
17+
}
18+
grAsset.ci = '';
19+
grAsset.setWorkFlow(false);
20+
grAsset.update();
21+
}
22+
}

0 commit comments

Comments
 (0)