- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2014 07:48 PM
For reasons I can't go into we need discovery to no longer update the location field but update a new field called Discovered Location u_discovered_location. I can't find the script I need to update. Can anyone help me out?
Solved! Go to Solution.
- Labels:
-
Discovery
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2014 09:50 AM
If you don't want to modify the Shazzam probe, you can also put an "after" business rule on the 'discovery_device_history' table. It holds the CI in a reference field and you can dot-walk to the Discovery Schedule table. Of course that doesn't prevent the location form being written to the location field on the CI record, but I know a lot of clients have been hesitant to modify the OOB probes/sensors. You can set the location record to NULL and erase that value if you want though (or write another BR to reject any update to the location field).
conditions: !current.cmdb_ci.nil() && current.cmdb_ci.changs()
addLoc();
addLoc(){
var sysID = current.cmdb_ci;
var newLoc = new GlideRecord('cmdb_ci_hardware');
newLoc.addQuery('sys_id',sysID);
newLoc.query();
if(newLoc.next()){
//gs.log("Location name is: " + current.status.dscheduler.location);
newLoc.u_discovered_location = current.status.dscheduler.location;
//newLoc.location = NULL;
newLoc.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2014 12:14 PM
This should be in the Shazzam Sensor script. If you scroll down there is a function called "updateLocation".
Hope this helps.
updateLocation: function() {
if (!this.schedule.location)
return;
this.ciData.getData()['location'] = this.schedule.location;
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2014 10:47 AM
If you do modify the Shazzam sensor probe, I recommend copying it and marking the original as "active = false" so that you'll still get future updates to Shazzam.
(Apologies if I'm already telling y'all something you know.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2014 09:50 AM
If you don't want to modify the Shazzam probe, you can also put an "after" business rule on the 'discovery_device_history' table. It holds the CI in a reference field and you can dot-walk to the Discovery Schedule table. Of course that doesn't prevent the location form being written to the location field on the CI record, but I know a lot of clients have been hesitant to modify the OOB probes/sensors. You can set the location record to NULL and erase that value if you want though (or write another BR to reject any update to the location field).
conditions: !current.cmdb_ci.nil() && current.cmdb_ci.changs()
addLoc();
addLoc(){
var sysID = current.cmdb_ci;
var newLoc = new GlideRecord('cmdb_ci_hardware');
newLoc.addQuery('sys_id',sysID);
newLoc.query();
if(newLoc.next()){
//gs.log("Location name is: " + current.status.dscheduler.location);
newLoc.u_discovered_location = current.status.dscheduler.location;
//newLoc.location = NULL;
newLoc.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2014 07:08 AM
Hi prdelong,
Thanks for the info. Do we need to write a business rule on 'discovery_device_history' table if we want discovery to prevent updating particular field on the record for the specific class ?
Thanks!
Regards,
Sunil Safare