Microsoft 365 SaaS Integration - Why is Software Usage mapped using UPN instead of Email Address?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
Hello everyone,
We are using the Microsoft 365 SaaS Integration with ServiceNow SAM Pro and have observed that user records in the Software Usage table appear to be matched based on the User Principal Name (UPN).
In our Azure environment, some users have a different UPN and email address. Because of this, we are seeing cases where user information is not mapped correctly in ServiceNow.
Could you please clarify:
- Why does the Microsoft 365 SaaS Integration use UPN for user matching instead of the email address?
- Is there a specific reason email addresses are not used as the primary identifier?
- Can ServiceNow be configured to use the email address for matching users, or to match using both UPN and email address?
- What is the recommended approach when UPN and email address are different in Azure?
Any guidance would be appreciated.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
1 & 2. At O365 end , UPN is unique field but Email is not mandatory one which means Email could be empty.
3. On Software Usage table - you can not do anything
4. Workaround :
Do following customization to solve the issue
Create a Before insert,update BR on subscription table, which will execute at the end (highest order) ..Give proper trigger condition.
Sample screen shot.
Sample code (if any modification is required ,do it):
(function executeRule(current, previous /*null when async*/ ) {
var op = current.operation();
if (op == "update") {
if (current.user_principal_name && current.user == '') {
var upnp = current.user_principal_name;
var userGrp = new GlideRecord('sys_user');
userGrp.addEncodedQuery('email=' + upnp + '^ORuser_nameSTARTSWITH' + upnp );
userGrp.orderByDesc('sys_created_on');
userGrp.query();
if (userGrp.next()) {
current.user = userGrp.sys_id.toString();
}
} else {
var upn = current.user_principal_name;
var userGr = new GlideRecord('sys_user');
userGr.addEncodedQuery('email=' + upn + '^ORuser_nameSTARTSWITH' + upn );
userGr.orderByDesc('sys_created_on');
userGr.query();
if (userGr.next()) {
current.user = userGr.sys_id.toString();
}
}
}
})(current, previous);
Once done, Run the O365 job (OOB scheduled job and confirm whether your issue fixed or not.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti