Having issue associating SCCM info to a user

jesse-csu
Giga Contributor

We are using SCCM (integration 3.0) to feed into Service Now. SN is pulling in the data from SCCM correctly but we are having an issue associating the ci's to a user. SCCM is pulling in the users attached to a ci as domain\userid, but our users are already imported from LDAP and pull in as userid (not domain\userid). We are having a hard time trying to match the domain\userid to our users so that SN thinks they are one user instead of two. We have an "assigned to" field that we would like to populate with the ci they are associated with according to SCCM.   I think we just need a tweak to the transform map but I cannot figure out how to tie the two together. Long story short, we just want ci's pulled from SCCM attached to a userid loaded from ldap. Any help is greatly appreciated.

6 REPLIES 6

prdelong
Kilo Guru

This is the function that SN used in the SCCM integration to find the corresponding user for the computer (assuming you built the flat table in the wiki):



function setAssignedTo() {


      var userName = source.u_v_gs_compute_stem_username0;


      if (JSUtil.nil(userName))


              return;




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


      if (x > -1)


              userName = userName.substring(x + 1);




      target.assigned_to = GlideUser.getSysId("user_name", userName);


}






The field value will come in looking something like this: DOMAIN\USERNAME. This splits the incoming field on the '\' and does a lookup in the user table on the "user_name" field with the "USERNAME" part of the SCCM import. If those do not match up, then you need to figure out which field value to import from SCCM or which value corresponds to SCCM in the LDAP feed.



Without knowing the format of your incoming SCCM data, it's hard to give a specific recommendation. One thing I've done in the past is use email with this function, but you have to get that included in your SCCM feed.



function setAssignedTo() {


      var userName = source.u_email;


      if (JSUtil.nil(userName))


              return;



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


      if (x > -1)


              userName = userName.substring(x + 1);*/




      target.assigned_to = GlideUser.getSysId("email", userName);


}


Figuring out which field value to match is what I am having trouble with. The email option is a good alternative to consider. Thanks for your input.


Michael Kaufman
Giga Guru

There is an OOB script in the SCCM Transform Map that I sometimes adjust to adapt to domains.


setAssignedTo();


function setAssignedTo() {


      var userName = source.u_username0;


      if (JSUtil.nil(userName))


              return;


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


      if (x > -1)


              userName = userName.substring(x + 1);


  target.assigned_to = GlideUser.getSysId("user_name", userName);


}



Hope that helps,


Mike Kaufman


ServiceNow ELITE.com


I tried replacing var userName = source.u_v_gs_compute_stem_username0; with var userName = source.u_username0; but it didn't help. I believe it is a matter of finding what field value I need to replace in this script though. Thanks for your input.