cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Community Support
Community Support

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

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
Highlighted
Helper IV
Helper IV

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

Highlighted
Super User III
Super User III

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
Highlighted
Community Support
Community Support

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

Highlighted
Helper IV
Helper IV

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

Hi @v-bacao-msft -

 

This worked perfectly! Thank you

 

m

Highlighted
Helper IV
Helper IV

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (5,849)