Skip to main content

Notifications

Power Automate - Building Flows
Suggested answer

Creating and Updating records in Dataverse from SharePoint

(0) ShareShare
ReportReport
Posted on by 260
Hello All,
 
I have a SharePoint list that is connected to a Power App. I want to move that data to Dataverse. Eventually, we would like to connect directly to Dataverse but right now the data source for the app is SharePoint. I would like to create a flow that adds or updates data in the Dataverse when a record is created or updated in SharePoint. I have found multiple videos on how to import data from SharePoint to the Dataverse but that's not what I'm looking for. I would like to replicate something similar to Reza Dorrani's video Add & Update Excel Data to SharePoint List using Power Automate. If anyone can point me in the right direction, I would greatly appreciate it!
  • Ninjasabi Profile Picture
    Ninjasabi 120 on at
    Creating and Updating records in Dataverse from SharePoint
    Glad you came right! Nicely done 
  • nleuck_101 Profile Picture
    nleuck_101 260 on at
    Creating and Updating records in Dataverse from SharePoint
    Nevermind I solved that issue as well. This part in your example was failing for me.

  • nleuck_101 Profile Picture
    nleuck_101 260 on at
    Creating and Updating records in Dataverse from SharePoint
    I solved my previous error but now I'm getting this error when I update a record. Any ideas?



  • nleuck_101 Profile Picture
    nleuck_101 260 on at
    Creating and Updating records in Dataverse from SharePoint
    I'm getting the following error:


    It's not finding the column in my Dataverse named SharePoint_ID
  • Suggested answer
    Ninjasabi Profile Picture
    Ninjasabi 120 on at
    Creating and Updating records in Dataverse from SharePoint

    To create a flow that adds or updates data in Dataverse when a record is created or updated in SharePoint, you can use Power Automate to achieve this. Here’s a step-by-step guide to help you set up the flow:

    1. Trigger the Flow:

      • Use the "When an item is created or modified" trigger for SharePoint.
      • Site Address: (your SharePoint site)
      • List Name: (your SharePoint list)
    2. Get the Item Details:

      • Action: Get item
      • Site Address: (your SharePoint site)
      • List Name: (your SharePoint list)
      • Id: ID (from the trigger)
    3. Check if the Record Exists in Dataverse:

      • Action: List rows (Dataverse)
      • Table Name: (your Dataverse table)
      • Filter Query: sharepoint_id eq 'ID' (assuming you have a column in Dataverse to store the SharePoint item ID)
    4. Condition to Check if Record Exists:

      • Action: Condition
      • Condition: length(body('List_rows')?['value']) is greater than 0
    5. If Record Exists, Update the Record:

      • Action: Update a row (Dataverse)
      • Table Name: (your Dataverse table)
      • Row ID: first(body('List_rows')?['value'])?['dataverse_id'] (assuming dataverse_id is the unique identifier in Dataverse)
      • Map the fields from SharePoint to Dataverse
    6. If Record Does Not Exist, Create a New Record:

      • Action: Add a new row (Dataverse)
      • Table Name: (your Dataverse table)
      • Map the fields from SharePoint to Dataverse, including the SharePoint item ID

    Here is a more detailed breakdown of the steps in Power Automate:

    1. Trigger:

      • Action: When an item is created or modified
      • Site Address: (your SharePoint site)
      • List Name: (your SharePoint list)
    2. Get Item:

      • Action: Get item
      • Site Address: (your SharePoint site)
      • List Name: (your SharePoint list)
      • Id: ID (from the trigger)
    3. List Rows (Dataverse):

      • Action: List rows
      • Table Name: (your Dataverse table)
      • Filter Query: sharepoint_id eq '@{triggerOutputs()?['body/ID']}'
    4. Condition:

      • Action: Condition
      • Condition: length(body('List_rows')?['value']) is greater than 0
    5. If Yes (Record Exists):

      • Action: Update a row
      • Table Name: (your Dataverse table)
      • Row ID: first(body('List_rows')?['value'])?['dataverse_id']
      • Map the fields from SharePoint to Dataverse
    6. If No (Record Does Not Exist):

      • Action: Add a new row
      • Table Name: (your Dataverse table)
      • Map the fields from SharePoint to Dataverse, including the SharePoint item ID

    This approach ensures that your Dataverse table is updated with the latest data from SharePoint, whether it’s a new record or an update to an existing record.

    If you need further clarification or run into any issues, please let me know!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

End of Year Newsletter…

End of Year Community Newsletter…

Tuesday Tip #12 Start your Super User…

Welcome to a brand new series, Tuesday Tips…

Tuesday Tip #11 New Opportunities…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 144,609

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,420

Leaderboard