
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2017 01:05 PM
Hello Community!
I am writing a custom Sensor for a cluster of clusters that is incorporated within my company's infrastructure. I'm having a lot of trouble refering to the Solaris Server that is currently being discovered as I cannot find a way to get the sys_id. I've tried using the objects "current" and "this" and "result" and the function getValue() and none of them return anything useful. For example, the following code in the custom Sensor returns the following output (this is just the way I'm testing and debugging as I am not an admin):
new DiscoverySensor({
process: function(result) {
var theSysID = current.getValue('sys_id');
current.u_ci_description = "SysID from Sensor: " + theSysID +
"\n\nTHIS: " + JSON.stringify(this) +
"\n\nCURRENT: " + JSON.stringify(current) +
"\n\nRESULT: " + JSON.stringify(result);
},
type: "DiscoverySensor"
});
Note that I can write to the record using the "current" object, when I try to use current.sys_id or current.getValue('sys_id'), or the "this" or "result" objects, I get "undefined" or "null" or empty sets or information that I don't need:
SysID from Sensor: undefined
THIS: {"cache":{},"relatedListdataObj":{},"errorMap":{},"warningMap":{},"_defaultSave":true,"_debug":null,"_deviceCi":null,"_ciSchema":null,"type":"DiscoverySensor","ciData":{"ignoreFields":{"sys_created_by":true,"sys_updated_by":true,"sys_mod_count":true},"GlideRecordUtil":{},"debug_flag":false,"data":{},"rl_map":{},"cmdb_ci":null,"related":{}},"ci_data":{}}
CURRENT: {}
RESULT: {"output":"redacted information"}
Does anyone know how to get the unique identifier of the CI currently being discovered?
Thanks
Solved! Go to Solution.
- Labels:
-
Discovery
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2017 01:55 PM
Hi Michael,
You can probably use the following:
var deviceGR = this.getCmdbRecord();
current.u_ci_description = "SysID from Sensor: " + deviceGR.sys_id +
There is some documentation on the developer site for DiscoverySensor:
https://developer.servicenow.com/app.do#!/api_doc?v=jakarta&id=r_DSEN-getCmdbRecord
Regards,
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2017 01:55 PM
Hi Michael,
You can probably use the following:
var deviceGR = this.getCmdbRecord();
current.u_ci_description = "SysID from Sensor: " + deviceGR.sys_id +
There is some documentation on the developer site for DiscoverySensor:
https://developer.servicenow.com/app.do#!/api_doc?v=jakarta&id=r_DSEN-getCmdbRecord
Regards,
Dave

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2017 06:12 AM
Thank you, David! This is exactly what I was looking for!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2017 09:48 PM
Please do go through the below article to get some more insights: