Forum Discussion
Item validation based on 2 columns
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.
- ganeshsanapAug 02, 2022MVP
philipp777 You have two options to check the same data is already available in list or not:
- Just before submitting the list form - if you have any button for submit, use "OnSelect" property of button to add formula & logic.
- "OnChange" property of individual field control in form.
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.
- philipp777Aug 02, 2022Copper Contributor
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",""
)- philipp777Aug 02, 2022Copper ContributorCould someone help me out with the formula? Thanks!