"Start Microsoft Teams Chat" on INC is only working for internal user and not for external user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 04:01 AM - edited 07-10-2024 04:03 AM
We have implemented the "Start Microsoft Teams Chat" button on Incident table and it is only working for the internal users and NOT for the external user. Both the type of users are present in the sys_user table.
Is there any way we can implement it for the external users as well?
Please refer the screenshot for the error we're getting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 06:40 AM
Hello @Neeraj Modi ,
You need to verify few things and refer code as an example:
1. Ensure that the external users are correctly configured and can be communicated with through Microsoft Teams. External users might need to be added as guest users in the Microsoft Teams environment.
2. Verify that the email addresses of external users in the sys_user table are correct and match the email addresses used in Microsoft Teams.
3. Ensure that the integration settings in ServiceNow for Microsoft Teams allow for external users. There might be specific configuration settings that need to be adjusted to include external participants.
4. You may need to modify the script or logic that initiates the Microsoft Teams chat to handle external users. This could involve checking the user's type and applying different logic for external users.
5. Add logs to get more detailed information about why external users are not recognized.
// Example Script to Start Microsoft Teams Chat
(function() {
var participants = []; // Array to hold participants
// Function to add participants
function addParticipant(user) {
if (user) {
participants.push(user.email);
} else {
gs.error("Invalid user: " + user);
}
}
// Get internal user
var internalUser = new GlideRecord('sys_user');
internalUser.get('sys_id', 'internal_user_sys_id');
addParticipant(internalUser);
// Get external user
var externalUser = new GlideRecord('sys_user');
externalUser.get('sys_id', 'external_user_sys_id');
addParticipant(externalUser);
// Check if participants are valid
if (participants.length > 0) {
// Call Microsoft Teams API or Integration to start chat
var response = startTeamsChat(participants);
if (response.success) {
gs.info("Chat started successfully with participants: " + participants.join(', '));
} else {
gs.error("Failed to start chat: " + response.error);
}
} else {
gs.error("No valid participants to start chat.");
}
// Function to start Microsoft Teams chat
function startTeamsChat(participants) {
// Placeholder for Teams API call
// Implement the API call to Microsoft Teams to start the chat
return { success: true }; // Replace with actual API call result
}
})();
Thank you!!
Dnyaneshwaree Satpute
Tera Guru