SCCM Integration

Pranita2
Kilo Guru

Hi,

We have implemented SCCM Integration, and observed that "Assigned to" field is not getting updated by the import.

Can anybody help me to get "Assigned to" field get updated from SCCM import?

 

Many thanks

Pranita

14 REPLIES 14

Hi,

Try this and check if you get proper logs.

function setAssignedTo() {
    var userName = source.u_username;
    if (JSUtil.nil(userName))
        return;

    var x = userName.indexOf("\\");
    if (x > -1)
        userName = userName.substring(x + 1);
gs.log('USer Name '+userName,'SCCMTESTING');

if (JSUtil.nil(userName))
return;
else {
var nameField = gs.getProperty('glide.discovery.assigned_user_match_field', "user_name");
    target.assigned_to = GlideUser.getSysId(nameField, userName);
}

 

Thanks,
Ashutosh

Also check what value you are getting in import set in u_username field (I expect it to be like domain\userID but it could be different as well) and what you have on user table in user_name.
If possible give use a sample so we can debug more based on the values.

 

I tested OOTB code and it works fine.

 

Make sure the user in Run as useron SCCM System <version> import scheduled data import record is having rights to read the user_name field on user table.

 

-Tanaji

Please mark response correct/helpful if applicable

 

 

lmundere
Kilo Sage

Actually I have the same issue, following here if an answer will be found. I tried to re-work on the mapping and ended up pulling a field called u_user_principal_name0, because In my case, I am using email in the field of user_name on Sys_user table, and then modified the script as follow: 

function setAssignedTo(){
	var mail = source.u_user_principal_name0;
if(mail != ''){
	var gr = new GlideRecord('sys_user');
	gr.addQuery('user_name', mail);
	gr.query();
	if(gr.next()){
		target.assigned_to = gr.sys_id;
		//gr.update();
	}
}
}

 

But this doesnt still work, any idea? 

Is user_name field on user table containing email? Or you script should have email is addQuery?

-Tanaji
Please mark response correct/helpful if applicable

And what is the value in u_username field on SCCM <version> Computer Identity [imp_sccm<version>_computer_id] table.

-Tanaji
Please mark response correct/helpful if applicable