DEV Community

Cover image for How to Trigger an Azure Logic App from Power Automate to Update a SharePoint List
Nikhil Sarpatwari
Nikhil Sarpatwari

Posted on

How to Trigger an Azure Logic App from Power Automate to Update a SharePoint List

I’ve been working with Power Automate and Dynamics 365 for years, and it’s great for streamlining processes. But sometimes, you need to tap into Azure Logic Apps for more robust integrations, like syncing with external systems. I recently set up a flow to trigger a Logic App from Power Automate to process Dynamics 365 case data and update a SharePoint list for team tracking. It’s a clean way to keep everyone in the loop. Here’s how to do it, starting with a new case in Dynamics 365.

Why Pair Power Automate with Logic Apps?

Power Automate handles quick automations in Dynamics 365 easily. But for complex integrations—say, calling an external API and pushing results to a SharePoint list—Logic Apps offers more power and flexibility. This combo lets you start with a simple trigger in Power Automate and let Logic Apps tackle the rest.

The scenario: when a case is created in Dynamics 365, Power Automate triggers a Logic App to call an API (like a case categorization service) and update a SharePoint list with the results.

Steps to Pull It Off

1. Create the Logic App

  • Head to the Azure Portal. Search for Logic Apps and click Create.
  • Pick your subscription and resource group. Name it something like CaseSharePointSync. Use the Consumption plan to pay per run.
  • Deploy it and open the Logic App.

2. Build the Logic App Workflow

  • Go to Workflows, add a new one, and name it UpdateCaseList.
  • Start with the When an HTTP request is received trigger. You’ll get a URL for Power Automate to call.
  • Set the request body schema for Dynamics 365 case data:
  {
    "caseId": "string",
    "description": "string"
  }
Enter fullscreen mode Exit fullscreen mode
  • Add an HTTP action to call an API:
    • Method: POST
    • URI: Your API endpoint (e.g., a mock case categorization API).
    • Body: Use the description field (triggerBody()['description']).
  • Add a Create or update item action for SharePoint:
    • Site Address: Your SharePoint site URL.
    • List Name: A list like “Case Tracker” with columns for CaseID, Category, and Description.
    • Title: triggerBody()['caseId']
    • Fields: Map Category to the API output (e.g., body('HTTP')['category']) and Description to triggerBody()['description'].
  • Add a Response action to confirm it worked:
    • Status: 200
    • Body: {"status": "Updated", "caseId": triggerBody()['caseId']}
  • Save it and copy the HTTP trigger URL.

3. Set Up the Power Automate Flow

  • Go to Power Automate and create a new Automated cloud flow.
  • Use the When a record is created trigger for Dataverse:
    • Table: Cases
    • Scope: Organization
  • Add an HTTP action to call the Logic App:

    • URI: Paste the Logic App’s HTTP trigger URL.
    • Method: POST
    • Body:
    {
      "caseId": "@{triggerOutputs()?['body/caseid']}",
      "description": "@{triggerOutputs()?['body/description']}"
    }
    
  • Optional: Add a Parse JSON action to read the Logic App’s response:

    • Content: HTTP action’s body.
    • Schema: {"status": "string", "caseId": "string"}
  • Add an action if needed, like updating the Dynamics case with a status note.

  • Save and test it. Create a case in Dynamics 365 and check if the SharePoint list updates.

Tips I Wish I Knew Sooner

  • Grab the URL Fast: Copy the Logic App’s HTTP trigger URL right after adding the trigger—it’s not easy to find later.
  • Test the API Alone: Verify your API call works before wiring up SharePoint. Saves headaches.
  • SharePoint Access: Make sure the Logic App’s SharePoint connector has permissions to your site and list.
  • Check Logs: If it fails, dig into Run History in Power Automate or Logic Apps for clues.

Why It’s Worth It

This setup kept a team’s case tracking in sync without manual updates. It’s handy for any scenario where you need to push Dynamics 365 data to SharePoint, and Logic Apps handles the scale better than Power Automate alone.

What Else Can You Do?

  • Add error handling in the Logic App, like a fallback if the API bombs.
  • Pull the SharePoint list into Power BI for case reports.
  • Trigger another flow when the SharePoint list updates.

Top comments (0)