- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2015 06:16 AM
My script successfully creates an incident, but I'd like the configuration item of each incident to be the 'ServiceNow' application. This is what I have:
var grInc = new GlideRecord('incident');
grInc.initialize();
grInc.cmdb_ci = 'ServiceNow';
grInc.short_description = '...';
grInc.work_notes = '...' ;
grInc.insert();
The incident contains the description and notes, but the CI field is blank. I assume I should be assigning it to something other than a string, but after thorough searching I can't find how to do it.
Thanks in advanced.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2015 06:18 AM
Hi Jonny,
Since the configuration item field is a reference it's expecting a sys_id when you set it that way. I would try this line instead:
grInc.cmdb_ci.setDisplayValue('ServiceNow');
That way you can pass it the display value of the record as a string.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2015 06:18 AM
Hi Jonny,
Since the configuration item field is a reference it's expecting a sys_id when you set it that way. I would try this line instead:
grInc.cmdb_ci.setDisplayValue('ServiceNow');
That way you can pass it the display value of the record as a string.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2022 11:54 PM
i updated the same but instead of updating the cmdb ci , it created a new incident and updated the cmdb ci there.
this is my table transform script
(function transformRow(source, target, map, log, isUpdate) {
var grInc = new GlideRecord('incident');
grInc.initialize();
// grInc.cmdb_ci.setDisplayValue('ServiceNow');
grInc.contact_type = "System Generated";
grInc.u_caller.setDisplayValue("25baf8a6dbd6a810d7649254db961974");
grInc.caller_id.setDisplayValue("25baf8a6dbd6a810d7649254db961974");
grInc.opened_by.setDisplayValue("25baf8a6dbd6a810d7649254db961974");
grInc.u_verb = "Alert";
grInc.update();
})(source, target, map, log, action==="update");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2015 06:22 AM
Worked like a charm, thanks Brad!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2015 06:24 AM
No problem, and this wiki article is a great reference for GlideRecord methods:
http://wiki.servicenow.com/?title=GlideRecord#gsc.tab=0