Discovery not populating "Assigned To" user in CMDB

Dead Blade
Kilo Guru

I know the name of the probe that is suppose to populate the CMDB:   Windows - OS Information / Win32_ComputerSystem.UserName

But this has never worked.   I check the other post and I have computers with the "In Use" state, so that's not it.

I am wondering how to I enable this function to work.   It is currently set to Active and discovery is running on the workstations.

1 ACCEPTED SOLUTION

Patrick DeCarl1
ServiceNow Employee
ServiceNow Employee

Hi William,



OOTB property "glide.discovery.assigned_user_match_field" is set to use "user_name" field on the "sys_user" table to match the value discovery pulls back. If that value doesnt match what your system has, then you might need to change what field to use from sys_user to sync up.



All this can be found in the sensor of the probe.


View solution in original post

46 REPLIES 46

Patrick DeCarl1
ServiceNow Employee
ServiceNow Employee

Hi William,



OOTB property "glide.discovery.assigned_user_match_field" is set to use "user_name" field on the "sys_user" table to match the value discovery pulls back. If that value doesnt match what your system has, then you might need to change what field to use from sys_user to sync up.



All this can be found in the sensor of the probe.


I found:



new DiscoverySensor({


      process: function(result) {


              this.parseResult(result);


      },




      parseResult: function(result) {


              current.os_version = result.Win32_OperatingSystem.Version;


              current.os_service_pack = result.Win32_OperatingSystem.CSDVersion;




              var man = result.Win32_ComputerSystem.Manufacturer;


              var mod = result.Win32_ComputerSystem.Model;




              var mm = MakeAndModelJS.fromNames(man, mod, "hardware");


              current.manufacturer = mm.getManufacturerSysID();


              current.model_id = mm.getModelNameSysID();


              current.short_description = result.Win32_OperatingSystem.Description;




              // Contrary to what the name implies, this returns *OS* address width, not CPU


              var processors = g_array_util.ensureArray(result.Win32_Processor);


              current.os_address_width = processors[0].AddressWidth;




              this.setAssignedTo(result);


      },




      setAssignedTo: function(result) {


              var userName = result.Win32_ComputerSystem.UserName;




              if (!gs.nil(userName)) {


                      var x = userName.indexOf("\\");




                      if (x > -1)


                              userName = userName.substring(x + 1);




                      var nameField = gs.getProperty('glide.discovery.assigned_user_match_field', "user_name");


                      var userID = GlideUser.getSysId(nameField, userName);


                     


                      var atOverwrite = JSUtil.toBoolean(gs.getProperty('glide.wmi.assigned_to_always_overwrite', "true"));


                      if (!atOverwrite)


                              if (this._isAssignedToFilled())


                                      return;


                             


                      current.assigned_to = userID;


              }


      },


     


      /*


        * Is the assigned_to field already populated? Return true if yes; false if no.


        */


      _isAssignedToFilled: function() {


              var compGr = this.getCmdbRecord();


              if (JSUtil.notNil(compGr.assigned_to + ''))


                      return true;


             


              return false;


      },




      type: "DiscoverySensor"


});



But it is not assigning user.


Its under sys_properties table. The property name I gave should be there.


Hmmm, interesting.   I may need to submit a HI case.   Under our sys_properties table this isn't a sys_user column.   There are 2 Sys_ID columns.