cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Morghan
Helper IV
Helper IV

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
v-bacao-msft
Community Support
Community Support

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
ScottShearer
Super User III
Super User III

@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

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

@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
v-bacao-msft
Community Support
Community Support

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

Hi @v-bacao-msft -

 

This worked perfectly! Thank you

 

m

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
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,515)