Integrating ServiceNow with Microsoft Teams Approvals via Power Automate
Published Mar 06 2023 03:30 PM 12.1K Views
Microsoft

 

Integrating ServiceNow with Microsoft Teams Approvals via Power Automate

 

As more and more organizations move towards remote work, communication and collaboration tools have become essential for seamless and efficient workflows. Microsoft Teams is one such tool that allows teams to communicate, collaborate, and stay productive from anywhere. Teams Approvals is a feature within Microsoft Teams that enables users to create, manage, and track approvals directly within Teams. On the other hand, ServiceNow is a powerful platform for managing workflows, incidents, and service requests. Integrating Teams Approvals with ServiceNow can streamline approval processes and improve overall efficiency.

 

There are different ways to implement this integration, but in this post, we will discuss two scenarios. The first scenario involves setting up a scheduler trigger on Power Automate to retrieve pending approvals from Teams Approvals and update them in ServiceNow. The second scenario involves receiving pending approvals directly in ServiceNow and updating them accordingly. By the end of this post, you'll have a better understanding of how to integrate Microsoft Teams Approvals with ServiceNow and the benefits it can bring to your organization.

 

Prerequisites

 

Service Now Environment

 

ServiceNow provides a free development environment called the Now Platform (https://developer.servicenow.com/dev.do), which enables developers to quickly build, test, and deploy applications to improve workflows and productivity within their organizations. With a free account on the Now Platform, you can start building powerful applications that leverage ServiceNow's advanced capabilities for workflow management, incident management, and service requests. Whether you're an experienced developer or just getting started, the Now Platform offers a flexible and easy-to-use environment for creating custom solutions tailored to your organization's unique needs.

 

Microsoft Teams

 

  1. Go to the Microsoft Teams website (https://www.microsoft.com/en-us/microsoft-teams/group-chat-software) and click on the "Sign up for free" button.

  2. Enter your email address and click on "Next". If you already have a Microsoft account, you can sign in with that account.

  3. Create a new password and click on "Sign up".

  4. Follow the prompts to complete the setup process, such as entering your name and company information.

  5. Once your account is set up, you can download the Microsoft Teams app on your desktop or mobile device and start collaborating with your team.

With a free Microsoft Teams account, you can chat with colleagues, make voice and video calls, share files, and collaborate on projects from anywhere. Plus, with its seamless integration with other Microsoft products, such as Office 365 and SharePoint, Microsoft Teams can help streamline your organization's workflows and improve productivity.

 

Power Automate Environment

 

Microsoft provides a free Power Automate environment (https://powerautomate.microsoft.com/en-us/#home-signup), which enables users to automate workflows across multiple applications and services. With Power Automate, you can create automated processes, such as approvals, notifications, and data synchronization, to save time and increase efficiency. Whether you're a business user or a developer, the Power Automate environment provides an intuitive and easy-to-use interface for creating and managing workflows. Plus, with its seamless integration with other Microsoft products, such as Teams and SharePoint, Power Automate can help streamline your organization's workflows and improve collaboration.

 

Scenarios

 

First, ensure that you have a valid account for both Microsoft Teams and ServiceNow, as well as access to Power Automate.

 

1. Scheduled Trigger

 

Here's a scenario on how to integrate Microsoft Teams Approvals with ServiceNow using Power Automate's scheduled trigger:

 

  1. Open a web browser and go to the Power Automate portal.

  2. Sign into Power Automate using your Microsoft account or organizational account.

  3. Once you're signed in, you should see the Power Automate portal dashboard. On the left-hand menu, click on "Create" to create a new flow.

  4. Choose a template from the available options, or start from scratch by selecting "Instant - from blank" or "Scheduled - from blank" depending on whether you want to trigger the flow manually or automatically at a scheduled time.

 

create schedule flow.png

 

 

  1. Give your flow a name, such as "Get pending approvals from ServiceNow". Set the trigger to run at a suitable interval, such as every 30 minutes, and click on Create.

 

give the flow name.png

 

 

  1. Next, click on +New step to add a new actions to your flow:

add new step.png

 

 

  1. In the search bar, type "ServiceNow" and select the "ServiceNow" connector from the list of available connectors. Choose the appropriate action from the ServiceNow connector, in this case, the "List Records" connector:

add snow list records.png

 

  1. If this is your first time using the ServiceNow connector, you will be prompted to sign in to your ServiceNow account. Enter your ServiceNow instance name, username, and password to authenticate the connection.

snow account.png

 

The "Instance name" field should contain the name of your ServiceNow instance, such as "myinstance.service-now.com". The "Username" and "Password" fields should contain your ServiceNow login credentials.

 

snow connection.png

 

 

 

 

  1. Select the second Approval item from the Record Type tables in ServiceNow. This will enable you to retrieve pending approvals from the sysapproval_approver table instead of the sc_ic_aprvl_defn_staging one.

In case you want to know more about the ServiceNow tables, ServiceNow provides the REST API Explorer, which is a web-based tool that allows you to explore and test the ServiceNow REST APIs. You can use the REST API Explorer to understand the different REST APIs provided by ServiceNow and how to use them to perform various operations on your ServiceNow instance. It is available within your ServiceNow instance under the "System Web Services" menu.

 

approval table.png

 

  1. Click on the Show advanced options item and set the query to filter the results to only include pending approvals in the "requested" state that were created within the last 30 minutes (the same interval from our Schedule trigger).

This is the query value: state=requested^sys_updated_on>@{getPastTime(30,'Minute','yyyy-MM-ddTHH:mm:ss')}

 

query.png

 

  1. Click on the three dots (...) in the top right corner of the "List Records" step to access the dropdown menu. Select Rename, and in the "Rename step" dialog box, enter "Get pending approvals" as the new name for the step.

 

rename get approval.png

 

 

 

 

 

  1. Add a new step after the "Get pending approvals" step. In the search box, type "apply" and select the "Apply to each" control connector.

 

apply to each.png

 

  1. In the "Select an output from previous steps" box, select the value result from the "Format pending approval result" step.

  2. Click on the "Add an action" button to add a new action to the step.

  3. In the search bar, type "ServiceNow" and select the "ServiceNow" connector from the list of available connectors. Choose the "Get Record" connector:

get record.png

 

This step is needed to get the details about the approval, like short description, description and opened by.

  1. In the Record Type field, make sure to select the second "Task" item in the dropdown list, which corresponds to the "task" table and not the first table which is for the staging environment:

task table item.png

 

  1. In the System ID field, select the value Approval for.

  2. Click on the three dots (...) in the top right corner of the "Get Record" step to access the dropdown menu. Select Rename, and in the "Rename step" dialog box, enter "Get Task Detail" as the new name for the step.

  3. Click on the "Add an action" button to add a new action to the step. This step is to get the approver email.

  4. In the search bar, type "ServiceNow" and select the "ServiceNow" connector from the list of available connectors. Choose the "Get Record" connector.

  5. In the Record Type field, make sure to select the second "User" item in the dropdown list, which corresponds to the "user" table and not the first one which is for the staging environment.

 

get approver email.png

 

  1. In the System ID field, select the value Approver.

  2. Click on the three dots (...) in the top right corner of the "Get Record" step to access the dropdown menu. Select Rename, and in the "Get Approver email" dialog box, enter "Get Task Detail" as the new name for the step.

  3. Repeat the steps 19-21 to get the requestor email.

  4. In the System ID field, select the value Opened By.

 

get requestor email.png

 

 

  1. Click on the three dots (...) in the top right corner of the "Get Record" step to access the dropdown menu. Select Rename, and in the "Get Requestor email" dialog box, enter "Get Task Detail" as the new name for the step.

Follows the expected result:

 

get task approver and requestor tasks2.png

 

    The next step is sending the approval request to Microsoft Teams Approvals app.

     

    1. Add a new action after the "Get Requestor email" step, but yet inside the Apply to each loop. In the search box, type "Approvals" and select the Start and wait for an approval:

     

    start approval.png

     

    1. Select Approve/Reject - Everyone must approve for the Approval type field.

    2. Select the Short description for the title, the approver email for the Assigned to field and the description for the details field.

    approvals fields.png

     

    1. Add a new action after the "Start and wait for an approval" step, but yet inside the Apply to each loop. In the search box, type "Control" and select the Condition control:

     

    condition control.png

     

    1. Inform the value Outcome from the Start and wait for an approval step and the value Approve:

     

    if condition.png

     

     

     

    1. Add a new action for the If yes step. In the search box, type "ServiceNow" and select the Update Record control:

    update record approve.png

     

     

    This action will update the corresponding approval records in ServiceNow with the latest information retrieved from Microsoft Teams.

    1. In the Record Type field, make sure to select the second "Approval" item in the dropdown list, which corresponds to the "approval" table from production environment and not the first one which is for the staging environment.

    2. In the System ID field, select the Sys ID from the Get pending approvals step.

    3. In the Comments field, select the Responses Comments from the Start and wait for an approval step.

    4. In the State field, inform the value approved.

    5. Repeat the steps 32-35, but add the new action inside the If not step and the value rejected for the State field.

     

    approve reject steps.png

     

    Save the flow and enable it to run at the scheduled interval you specified.

    As approvals are requested and processed in Microsoft Teams, the scheduled flow will retrieve the pending approvals and update the corresponding records in ServiceNow.

    Access Microsoft Teams, open the Approvals App and observe that ServiceNow pending approvals will be there:

     

    teams approvals.png

     

     

    2. Http Trigger

    This topic is covered in the part 2.

     

    Related - Azure App Logic and Adaptive Card solution

    The following article demonstrates how to use Logic Apps (or Power Automate) to detect approval requests on ServiceNow and enable approvers to approve or reject requests directly from Teams via Adaptive Cards and Logic Apps.

     

    Furthermore, the fact that this solution does not require premium connectors and only requires user access that is cheap is a significant advantage. This means that even smaller organizations with limited budgets can benefit from this solution and automate their approval processes without having to invest heavily in expensive tools and software. Overall, this solution seems like an excellent way to automate approval processes and improve the efficiency of organizational workflows.

    Integrating ServiceNow and Teams with Logic Apps – Approvals

     

    Co-Authors
    Version history
    Last update:
    ‎Apr 17 2023 07:03 AM
    Updated by: