Using Power Automate create SharePoint list item if not exists promptly - Demo

Using Power Automate create SharePoint list item if not exists promptly – 0365

No comments

Loading

In this “Power Automate create SharePoint list item if not exists”, we will learn how to create a SharePoint list item if not exists using Power Automate. Like any other traditional language, we can create a list item in SharePoint if not exists – however, if the item already exists, we will update it.

Using Power Automate create SharePoint list item if not exists step by step guide

This is the complete flow – in this demo, what are doing is controlling the Add or Edit item detail in List B from List A. Adding an item to List A, if that item exists in List B it will update otherwise create it, here we are querying the List B with Title column for this demo. So, if the Title column value already exists in List B, it will update that list item otherwise if not exists, it will create a new item.

Using Power Automate create SharePoint list item if not exists
Using Power Automate create a SharePoint list item if not exists

This is a very simple flow, the first one is the trigger action, and the last two are needed for this item create or edit operation. Let’s expand and explain the Get Items action and Condition control.

Get Items from the SharePoint list with a filter query

Pass the below parameters for the Get items action:

  • Site Address – Your site URL
  • List Name – Your list name
  • Filter Query – Title eq ‘Title from the trigger output when an item is created or modified’
Get Items from SharePoint list with filter query
Get Items from the SharePoint list with a filter query

Power Automate check if item exists in SharePoint list

Add a condition control.

Power Automate check if item exists in SharePoint list
Power Automate check if the item exists in the SharePoint list

Then, add the below conditional check:


length(outputs('Get_items_from_list_B')?['body/value'])

Notes:

  • In the above length function, replace this “Get_items_from_list_B” text with your Get Items name text.
  • If the output of “Get Items body/value length” is zero, then, the item does not exist in List B, so, it will perform the create item operation – otherwise, the item already exists in List B, so it will perform the update item operation.

Length of the get items output in power automate

Find the length of Get Items Output in Power Automate
Find the length of “Get Items” Output in Power Automate

Summary: Using Power Automate create SharePoint list item if not exists

Thus, in this article, we have learned the below with respect to creating or updating SharePoint list items using Power Automate:

  • How to create a SharePoint list item if not exists.
  • How to update a SharePoint list item if already exists the item.
  • How to find the length of the output of the “Get Items” action which will determine whether to create or update the item in the SharePoint list.

See Also: Power Automate Tutorial

You may also like the below Power Automate tutorials:

 

About Post Author

Do you have a better solution or question on this topic? Please leave a comment