If your company uses Teams and Service Now, integrating the two systems can greatly improve your workflows. While Service Now offers a native bot for integration, you can also leverage other Microsoft technologies to create a more seamless integration.

In this article, I’ll show you how to use Logic Apps (or Power Automate) to detect approval requests on Service Now and enable approvers to approve or reject requests directly from Teams.

Before diving into the implementation details, let’s explore the alternatives for approving requests on Teams. While the Microsoft Approvals Teams app allows access to the list of requests made for your approval and keeps the list updated, it may not provide the desired level of customization. For a more tailored approach, you can generate custom approval adaptive cards.

Adaptive cards are a type of card-based UI that are platform-agnostic and allow for interactive communication. With this approach, you can create a custom card that enables approvers to chat with requestors by clicking a button and even offering custom buttons to open the original Service Now request, among other possibilities.

In the picture below, you can see a custom card generated to approve a Service Now request. Note that the card allows you to track back to the original request, chat with the requestor, and approve or reject the request.

This solution was implemented using Logic Apps, which automates the ServiceNow approval process by sending an adaptive card to an approver in Microsoft Teams and updating ServiceNow records based on the approver’s response. Here’s how the Logic App works:

  1. The Logic App is triggered manually with an HTTP request, which includes details about the approval request such as the approver’s information, due date, and approval record’s unique ID.
  2. The Logic App initializes a variable for the ServiceNow instance URL.
  3. Next, it retrieves details about the approval task from ServiceNow based on the provided ID.
  4. The Logic App then retrieves the email and user name of the approver and requestor from ServiceNow.
  5. It posts an adaptive card to the approver in Microsoft Teams, requesting their approval or rejection of the request.
  6. The Logic App then parses the response from the adaptive card to determine the approver’s decision.
  7. If the approver approves the request, the Logic App updates the approval record in ServiceNow with the “Approved” state and the user who updated it.
  8. If the approver rejects the request, the Logic App updates the approval record in ServiceNow with the “Rejected” state, the user who updated it, and the reason for rejection.

The Logic App leverages Azure API Connections to connect to ServiceNow and Microsoft Teams. It also uses the Parse JSON action to parse the response from the adaptive card and the Initialize Variable action to store the ServiceNow instance URL. To activate the Logic App workflow on the ServiceNow side, you can use a Business Rule that triggers on Inserts and Updates on the Approvals table.

(function executeRule(current, previous /*null when async*/) {

	// build the JSON with the approval request info
	var body = {
		"sysapproval": current.getValue("sysapproval"),
		"sys_id": current.getValue("sys_id"),
		"due_date": current.getValue("due_date"),
		"sys_created_by": current.getValue("sys_created_by"),
		"approver": current.getValue("approver")
};
	
	try {
		// calls the logic app flow and send the JSON string
		var request = new sn_ws.RESTMessageV2();
		request.setEndpoint("your logic apps endpoint");
		request.setHttpMethod("POST");
		// set the request body and headers
		request.setRequestBody(JSON.stringify(body));
		request.setRequestHeader("Content-Type", "application/json");

		// send the REST message
		var response = request.execute();
		
	} catch (ex) {
		// handle any exceptions that might occur
		gs.error("An error occurred while sending the REST message: " + ex.message);
}

})(current, previous);

By following these steps, you can create a more streamlined approval process that reduces manual effort and improves visibility across your organization.

My colleague Luis Demetrio also approached the same problem with a powerful custom solution, available on his GiutHub at luishdemetrio/MyApprovalsHub (github.com). He also has additional insights on how to improve the Business Rule code and use Power Automate instead of logic apps.

Enjoy.

Disclaimer – The information contained in this blog post doesn’t represent the official Microsoft guidance or best practices. It is just the view of the author on current alternatives, implementations and workarounds for common issues and/or business needs. Please refer to official Microsoft documentation and evaluate carefully any steps, code or procedures documented herein. The author doesn’t offer any warranty. Use this information at your own risk.