Discovery Source when multiple sources apply to a CI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2022 09:10 AM
Hi all,
We already had several data sources importing into our CMDB. We have recently now got ServiceNow discovery also discovering CIs.
For some CI's we have SNOW integration creating the CIs so the discovery source is SnowSoftware. These have since then been discovered by ServiceNow discovery which has updated the discovery Source to ServiceNow. Since purchasing Discovery, we are limiting which attributes SNOW can update, however when it updates these attributes it is setting the discovery source back to SnowSoftware. In the SNOW transform map there is a field map between the source u_discoversource and the target discovery_source.
I've tried to update this to the a source script as so:
answer = (function transformEntry(source) {
var discoverySource = source.u_discoverysource;
gs.info('---> SNOW Transform - Discovery Source: ' + discoverySource);
var snowID = source.u_id;
var computer = new GlideRecord('cmdb_ci_computer');
computer.addQuery('x_snsab_snow_sam_i_snow_computer_id', snowID);
computer.query();
if (computer.next()) {
gs.info('---> SNOW Transform - Found CI');
if (computer.u_servicenow_discovered == true) {
gs.info('---> SNOW Transform - SN Discovered');
return;
} else {
gs.info('---> SNOW Transform - NOT SN Discovered');
return discoverySource;
}
} else {
return discoverySource;
}
})(source);
I can see in the logs that it is finding the computer records, but it is not updating the discovery source when expected to.
We only want the discover source to be SnowSoftware when it creates the CI. Once that CI has been discovered by ServiceNow discovery the discovery source should become ServiceNow and should remain as ServiceNow. SNOW should be able to update the 4 attributes we have defined but when updating we don't want the discovery source to be changed, how can this be managed?
Thanks
Sam
- Labels:
-
Discovery
-
Multiple Versions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2022 08:01 PM
Could you do an onBefore script and skip all the logic you have?
if(action=='insert'){
target.discovery_source = 'SnowSoftware';
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2022 04:31 AM
Hi Scott,
Thanks for this. We would need it to work on updates too. Some of the CI's get manually created before being picked up by SNOW.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2022 10:31 AM
Hi Sam,
Did you try .update()?
and did you ever find a way to solve this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2022 02:04 AM
Hi, I recommend what value showing in sys_created_by field under import set table based on that define the manipulation and set the Discovery Source field.
Suresh.