cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Morghan
Level: Powered On

Need help to check if item exists in SP list

Hello, 

 

I have exhausted enough time and effort on this, I need help. I have a SharePoint list for users to request IT setup for new hires at our company. I have security on the list to only allow the users to see what THEY have created, no one else's. I understand there are restrictions with this... so am hoping to use Flow to help, but with there no longer being the "Edit in advanced mode" for Conditions, I feel a bit stuck and lost.

 

REQUIREMENT: When a new item is created in the list, I'd like Flow to check the existing list to see if the entered "New Hire Name" (text input) already exists (actual column name: New_x0020_Hire_x0020_Name). If it already exists, it'll send an email to the creator that it already exists and we're already on it. If it does not exist, I'll have it send a different set of emails/tasks. 

 

Secondly, I am not sure if it's possible to not even allow a duplicate item to get created if it already exists. I am *not* super concerned with that. I can always go into the list as an admin and clean it up later. 

 

Please help! Thank you in advance. 

 

m

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Need help to check if item exists in SP list

Hi @Morghan ,

 

You could use Filter Query to filter the item with same New Hire Name in the list.

Then use length() function to calculate the number of items. If it is greater than 0, it means that the item with the same name already exists.

Expression reference:

length(body('Get_items')?['value'])

Image reference:

19.PNG

Hope it helps.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Super User
Super User

Re: Need help to check if item exists in SP list

@Morghan 

I believe that your issue can be sovled easily without using Flow for the duplicate entry check.

  • Go to list settings and click on the New Hire Name column
  • Set Enforce Unique Values to yes

Doing so will prevent users from entering the same name twice.  That said, there is always a chance that the users will enter the names in a slightly different fashion and it will slip through.  This would also be true if you were to use a Flow.

Unique.jpg

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Morghan
Level: Powered On

Re: Need help to check if item exists in SP list

Hi @ScottShearer

 

I appreciate the quick response. However, that does not work because of the security set on the list. The list has to be open to everyone in order to Enforce Unique Values but I have it intentionally set to have users only see items they have created. If I try, I receive error "This column cannot enforce unique values because this list or document library may contain items that are not viewable by all users."

 

m

Super User
Super User

Re: Need help to check if item exists in SP list

@Morghan 

I forgot about that....  Good catch.

I will create a Flow and update this post later tonight that checks for duplicates.

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Community Support Team
Community Support Team

Re: Need help to check if item exists in SP list

Hi @Morghan ,

 

You could use Filter Query to filter the item with same New Hire Name in the list.

Then use length() function to calculate the number of items. If it is greater than 0, it means that the item with the same name already exists.

Expression reference:

length(body('Get_items')?['value'])

Image reference:

19.PNG

Hope it helps.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Morghan
Level: Powered On

Re: Need help to check if item exists in SP list

Hi @v-bacao-msft -

 

This worked perfectly! Thank you

 

m

Morghan
Level: Powered On

Re: Need help to check if item exists in SP list

Hi @v-bacao-msft 

 

I discovered last night that this expression is resulting to TRUE even if it's FALSE... I've used a name that definitely does NOT exist in the list, but still resulting in TRUE.... Any ideas? 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 351 members 6,320 guests
Please welcome our newest community members: