Transform Mapping from Intune to CMDB_CI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2024 03:33 PM - edited ‎04-18-2024 03:35 PM
I'm trying to create a Transform Map that takes the Rest API call to Intune and writes the devices to CMDB_CI. I've been successful except for one thing. If I map the Intune Field "userPrincipalName" (which comes back as the email address) to the "Assigned To" field, users with longer names exceed the 32 Max Character Limit on the Assigned To field just display a truncated email (first.last-otherlast@gmail.or) instead of finding the correct User from the reference table.
If I map the Intune Field "userDisplayName" to the "Assigned To" field, users with the same name but different emails (first.last1@gmail.com vs first.last2@gmail.com) have a seemingly random chance of being the user in the Assigned To field.
1. From my research, it seems like there's no way to increase the Max Character Limit of the Assigned To field which comes from the base CMDB table (please correct me if I'm wrong as that would be the easiest solution).
2. Is there a script that would turn the userPrincipalName (email address) into the right user from sys_user and THEN map it to Assigned To? I've tried to write a few but no luck so far.
answer = (function transformEntry(source) {
var gr = new GlidRecord('sys_user');
var userName = '';
gr.addQuery('email', source.u_userprincipalname);
gr.query();
userName = gr.name;
return userName; // return the value to be put into the target field
})(source);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-31-2024 07:36 AM
you probably already got the answer but map the user's email to the assigned to field and it'll update to the user's name since that is the "display" of that field.
The user's email is the primary key so it'll find the user then show you the field with "display"