Do you need to check if an item exists in the SharePoint list using Power Automate? This tutorial is for you. Here I have explained how to check if an item exists in a SharePoint list or not using Power Automate. If you follow the below steps, I’m sure you will meet the need.
Scenario:
The flow triggers manually and requests users to enter the input values, and it checks whether the entered values are presented in the SharePoint list item or not. If the item is not presented it creates a new item with the user-requested values else it displays an item that already exists in the compose data operation.
Follow the below steps, to achieve this:
Check if an item exists in a SharePoint list using Power Automate
Let us see how to check if an item exists in the SharePoint list using the Power Automate flow
In this example, I am going to use the Employee SharePoint list consisting of,
- EmployeeID – default title column
- EmployeeName – Text type
- EmployeeDesignation- Text type
- DateofJoining- Date and Time type
- EmployeeStatus- Choice type
- ContactNumber- Number type
- EmployeeEmailAddress- Text type
Step-1:
- Login to Power Automate using Microsoft credentials, Select the +create, and choose instant cloud flow.
- Enter the flow name and click on the create option.
Step-2:
Expand the Manual trigger action and add the inputs for the below fields,
- EmployeeID – Text type
- EmployeeName – Text type
- EmployeeDesignation- Text type
- EmployeeEmailAddress- Email
- DateofJoining- Date and Time type
- ContactNumber- Number type
Step-3:
- Add +new step, select get items action from action triggers, and configure the SharePoint site address and List name.
- In the Filter query field add conditions for unique columns: Here I have taken EmployeeID, EmployeeEmailAddress, and ContactNumber fields.
- If any of these fields contains the user-requested value it will not create a new item in the SharePoint list. Instead, it displays items with the same information that exists already in the SharePoint list.
"Title eq '@{triggerBody()['text']}' or EmployeeEmailAddress eq '@{triggerBody()['email']}' or ContactNumber eq '@{triggerBody()['number']}'"
Where,
- Title, EmployeeEmailAddress, and ContactNumber = Column internal names
- triggerBody()[‘text’], triggerBody()[’email’] and triggerBody()[‘number’] = User Inputs
Step-4:
Add a condition control and check if the item exists in the SharePoint list or not by using the below formula.
length(outputs('Get_items')?['body/value'])
- If yes, select the create item action from the action trigger and configure the SharePoint site address and list name.
- Add dynamic content values for all the fields as shown below:
- If no, add a compose data operation and pass the input value as the item already exists in the SharePoint list.
Step-5:
Save and Enter the details and run the flow by selecting the run flow option.
Case-1:
Here I am going to pass the same email address (highlighted in red) that already exists in the SharePoint list item.
Enter the details and click the run flow option.
Once the flow runs successfully, we can see that it doesn’t create new items because an item with requested input already exists in the SharePoint list.
Case-2:
Here I am going to enter the values that are not presented in the SharePoint list item. Click the run flow option.
Once the flow runs successfully, we can see that it creates a new item in the SharePoint list.
Refresh the SharePoint list, you can see the new item has been added with the user-requested inputs.
This is how to check if an item exists in the Sharepoint list using Power Automate flow.
Conclusion
In this Power Automate tutorial, I have explained how to check whether an item exists in the SharePoint list or not using Microsoft Flow or Power Automate.
You may also like:
- Create Hyperlink Dynamic Content in Power Automate
- How to use append to string variable action in Power Automate?
- Convert time zone in Power Automate
- Power Automate Send 7 or 14 Day Task Due Reminder Emails
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.