Start Microsoft Teams chat from Incident Task

Chris Petrone
Tera Expert

Is it possible to start a Microsoft Teams Chat from an Incident Task? Is this something that is configurable natively or is it custom configuration? Is it as simple as adding the UI action to the form?

1 ACCEPTED SOLUTION

a5hubh
Tera Expert

Starting a Microsoft Teams chat from an Incident Task in ServiceNow can be a powerful integration to enhance collaboration directly from the ServiceNow interface. While ServiceNow does not provide a native out-of-the-box integration specifically for starting a Microsoft Teams chat from an Incident Task, this functionality can be achieved through custom configuration.

Here’s how you can set this up:

Steps to Configure a Custom UI Action to Start a Microsoft Teams Chat

  1. Create a UI Action:

    • Navigate to System Definition > UI Actions.
    • Click New to create a new UI Action.
  2. Configure the UI Action:

    • Name: Provide a meaningful name like "Start Teams Chat".
    • Table: Select Incident Task (or the specific table you want to add this action to).
    • Action Name: Give a unique action name.
    • Order: Set the order to determine where it appears on the form.
    • Condition: Set any conditions required for the button to appear (optional).
    • Script: Add a script to construct the Microsoft Teams chat URL. Here is an example script:
    (function executeAction(current) {
        // Assuming that 'assigned_to' field is used and it stores user information
        var user = new GlideRecord('sys_user');
        user.get(current.assigned_to);
        
        // Construct the Microsoft Teams chat URL
        var teamsUrl = 'https://teams.microsoft.com/l/chat/0/0?users=' + user.email;
        
        // Redirect to the Teams chat
        action.setRedirectURL(teamsUrl);
    })(current);
    • Form Button: Check this if you want the action to appear as a button on the form.
    • Show insert and Show update: Check these boxes if the button should be visible on new and existing records.
  3. Save and Test:

    • Save the UI Action.
    • Open an Incident Task record and verify that the new UI Action button appears.
    • Click the button to ensure it opens a Microsoft Teams chat with the assigned user.

Explanation:

  • User Retrieval: The script retrieves the email of the user assigned to the task using the assigned_to field. Ensure this field or the field you are using contains valid email addresses.
  • Microsoft Teams URL: The constructed URL opens a Microsoft Teams chat with the specified user’s email. Adjust the URL structure if necessary based on your specific requirements.
  • Action Redirection: The action.setRedirectURL(teamsUrl) function redirects the browser to the Microsoft Teams chat URL.

Additional Considerations:

  • Permissions: Ensure that users have the necessary permissions to access Microsoft Teams.
  • Email Format: Verify that the email format in the assigned_to field matches the expected format for Microsoft Teams.
  • User Training: Educate users on how to use the new button and ensure they understand its functionality.

By following these steps, you can successfully integrate Microsoft Teams chat functionality into your ServiceNow Incident Task form. This customization provides a seamless way for users to initiate a Teams chat directly from ServiceNow, enhancing collaboration and communication within your organization.

View solution in original post

1 REPLY 1

a5hubh
Tera Expert

Starting a Microsoft Teams chat from an Incident Task in ServiceNow can be a powerful integration to enhance collaboration directly from the ServiceNow interface. While ServiceNow does not provide a native out-of-the-box integration specifically for starting a Microsoft Teams chat from an Incident Task, this functionality can be achieved through custom configuration.

Here’s how you can set this up:

Steps to Configure a Custom UI Action to Start a Microsoft Teams Chat

  1. Create a UI Action:

    • Navigate to System Definition > UI Actions.
    • Click New to create a new UI Action.
  2. Configure the UI Action:

    • Name: Provide a meaningful name like "Start Teams Chat".
    • Table: Select Incident Task (or the specific table you want to add this action to).
    • Action Name: Give a unique action name.
    • Order: Set the order to determine where it appears on the form.
    • Condition: Set any conditions required for the button to appear (optional).
    • Script: Add a script to construct the Microsoft Teams chat URL. Here is an example script:
    (function executeAction(current) {
        // Assuming that 'assigned_to' field is used and it stores user information
        var user = new GlideRecord('sys_user');
        user.get(current.assigned_to);
        
        // Construct the Microsoft Teams chat URL
        var teamsUrl = 'https://teams.microsoft.com/l/chat/0/0?users=' + user.email;
        
        // Redirect to the Teams chat
        action.setRedirectURL(teamsUrl);
    })(current);
    • Form Button: Check this if you want the action to appear as a button on the form.
    • Show insert and Show update: Check these boxes if the button should be visible on new and existing records.
  3. Save and Test:

    • Save the UI Action.
    • Open an Incident Task record and verify that the new UI Action button appears.
    • Click the button to ensure it opens a Microsoft Teams chat with the assigned user.

Explanation:

  • User Retrieval: The script retrieves the email of the user assigned to the task using the assigned_to field. Ensure this field or the field you are using contains valid email addresses.
  • Microsoft Teams URL: The constructed URL opens a Microsoft Teams chat with the specified user’s email. Adjust the URL structure if necessary based on your specific requirements.
  • Action Redirection: The action.setRedirectURL(teamsUrl) function redirects the browser to the Microsoft Teams chat URL.

Additional Considerations:

  • Permissions: Ensure that users have the necessary permissions to access Microsoft Teams.
  • Email Format: Verify that the email format in the assigned_to field matches the expected format for Microsoft Teams.
  • User Training: Educate users on how to use the new button and ensure they understand its functionality.

By following these steps, you can successfully integrate Microsoft Teams chat functionality into your ServiceNow Incident Task form. This customization provides a seamless way for users to initiate a Teams chat directly from ServiceNow, enhancing collaboration and communication within your organization.