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:
Trigger the Flow:
Get the Item Details:
ID
(from the trigger)Check if the Record Exists in Dataverse:
sharepoint_id eq 'ID'
(assuming you have a column in Dataverse to store the SharePoint item ID)Condition to Check if Record Exists:
length(body('List_rows')?['value'])
is greater than 0If Record Exists, Update the Record:
first(body('List_rows')?['value'])?['dataverse_id']
(assuming dataverse_id
is the unique identifier in Dataverse)If Record Does Not Exist, Create a New Record:
Here is a more detailed breakdown of the steps in Power Automate:
Trigger:
Get Item:
ID
(from the trigger)List Rows (Dataverse):
sharepoint_id eq '@{triggerOutputs()?['body/ID']}'
Condition:
length(body('List_rows')?['value'])
is greater than 0If Yes (Record Exists):
first(body('List_rows')?['value'])?['dataverse_id']
If No (Record Does Not Exist):
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!