I have a SharePoint list with several columns. I need to prevent users from entering duplicate combinations of Staff ID and Date. I created a calculated column to merge these two fields, but I discovered that calculated columns can't enforce unique values. I've been advised to use a Power Automate flow. Could someone please provide the steps and flow actions needed to achieve this?
For the person who advised you to use Power Automate, what did they suggest you do through Power Automate? A round idea would be:
Create a text column in your list to hold the combined value.
Add a flow with a trigger when a new item is created.
Use a compose action to generate the value to populate in the SharePoint list.
Use a Get items action from the SharePoint list with a filter query using the Output of the above compose action in a filter query to see if there are any items in list with the value.
Add a condition with a length expression to find how many items are returned from the get items action. The condition will be where the length of what is returned is equal to 0 (zero).
On the yes side of the condition, if not items found, update the item from the trigger with the value.
On the no side, send an e-mail or do whatever you want to tell the person an item already exists with that value and then delete the item.
Was this reply helpful?YesNo
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.