Aug 01 2022 11:54 PM
Hello everyone,
I want to avoid that users create the item twice in my SharePoint list "reporting". I want to validate that with 2 columns:
So, my goal is that there is only one item with US10 and 2022-Q1-Q2.
Is there a way to do that with a validation formula in SharePoint or do I have to create a workflow with Power Automate?
Thanks in advance!
Aug 02 2022 12:00 AM
@philipp777 You cannot use the lookup columns in SharePoint validation formula. Also, you cannot check the column values of another list items in formula.
Best solution for you would be to customize the list forms using Power apps & add these validation in forms using power apps formulas.
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
Aug 02 2022 12:07 AM - edited Aug 02 2022 12:09 AM
Using Column validation it's not possible.
Power Automate will not help to avoid entry into list as Power Automate can run once Item is added already. Of course using Power Automate you can validate whether entry is duplicated based on two SharePoint columns and you can take necessary action after i.e. like removing entry and informing author via email about duplicate.
Here the suggested approach would be to customize your list form using Power Apps and there you can handle this validation.
Reference Link for Power Apps: (This link shows solution for only one column you need to adapt it according to your requirement).
Hope it will helpful to you.
Aug 02 2022 12:16 AM
Aug 02 2022 12:23 AM
@philipp777 You have two options to check the same data is already available in list or not:
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
Aug 02 2022 12:48 AM - edited Aug 02 2022 02:05 AM
Thanks. I would go with option 2, because I want to include the PowerApp in the SharePoint form and use the default "save" button. Can I deny the user saving his data, when the condition is true (e.g. greying out the save button)?
This is my formula, but not working yet:
If(
And(CountRows(Filter(mylist, C_x002d_Code = Trim(DataCardValue1.Text))),CountRows(Filter(mylist, Period = Trim(DataCardValue1.Text))) > 0),
"Duplicate C-Code and Period not allowed",""
)
Aug 02 2022 03:06 AM