web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Power Apps form valida...
Power Apps
Unanswered

Power Apps form validation from Dataverse

(0) ShareShare
ReportReport
Posted on by 63

Hi Team,

I am new to power apps, and I wanted to have a functionality in my  form that will add new record to my  Dataverse Table but prevent  consecutive entry by the same user.

Ex:  So when XYZ user will form for booking a  slot, a row gets added and slot remaining gets updated.

However, when he tries to book again for 13/06 , he should get error that you cannot have 2 consecutive leaves.

Can someone pls help me how can I add this to form in Power Apps?

DateInitial SlotBooked BySlot Remaining
12/06/20233XYZ2


I have no clue how to make a form either using Dataverse.
And adding these rules,Its my first project, really appreciate your help here.

Thanks !

Categories:
I have the same question (0)
  • Shaheer Ahmad Profile Picture
    2,194 Moderator on at

    Sure! I can help you with adding form validation to your Power Apps form in order to prevent consecutive entries by the same user. Here's an outline of the steps you can follow:

    1. Create a Canvas app in Power Apps and connect it to your Dataverse table.

    2. Add a new form control to your canvas app by clicking on the "Insert" tab and selecting the "Forms" option. Choose the table you want to work with from the available options.

    3. Customize the form control by selecting the fields you want to display and arrange them as needed. You can do this by selecting the form control and using the options in the "Properties" pane.

    4. Add a button to the form that will submit the data and trigger the validation. You can add a button control from the "Insert" tab.

    5. In the button's OnSelect property, add a formula that performs the validation before saving the record. Here's an example of how the formula might look:

     

    If(
     CountRows(
     Filter(
     'YourTableName',
     'Booked By' = User().FullName,
     Date = Today()
     )
     ) > 0,
     Notify("You cannot have 2 consecutive leaves.", NotificationType.Error),
     Patch('YourTableName', Form1.Updates)
    )

     

    In this formula, 'YourTableName' should be replaced with the name of your Dataverse table, and 'Booked By' and 'Date' should be replaced with the corresponding field names in your table.

    The formula checks if there are any existing records in the table for the current user and today's date. If such records exist, it displays an error notification. Otherwise, it uses the Patch function to save the record to the table.

    1. Customize the error notification message as needed by modifying the string inside the Notify function.

    That's it! With this setup, when a user tries to book a slot for a consecutive day, they will receive an error message indicating that it's not allowed. Otherwise, the record will be saved to the Dataverse table.

    Remember to test your app thoroughly to ensure that the validation is working as expected. Let me know if you need any further assistance!

  • alexa_028 Profile Picture
    63 on at

    Thank you so much for your reply, but the date can be anywhere in future , example user cannot have 20/21st july booked , it doesn't have to be based on today.

     

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.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard