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 / Validation logic befor...
Power Apps
Unanswered

Validation logic before a record is saved

(0) ShareShare
ReportReport
Posted on by 108

We are building a simple model driven app to manage card keys.  The app aims to keep track of who used the card key and when it was returned.

 

The tables we have are:

- CardKey

- Transaction

 

The user creates a Transaction record and in its look-up field he selects a Card key record and save the record.  When the user returns the card key, he would select the return date time and save it.  Now we want to prevent other users from using the same card key that someone else currently uses.  If the user selects a card key that has already been in someone else's hand, at the time of pressing "save" icon I want to display a warning message so that the user knows he needs to select other card.  I think I should implement some sort of validation logic before the record is saved in Dataverse to achieve the above case.  Looking at the "Business Rule", I don't think it fits in this scenario.  Does anyone have ideas for it?

I have the same question (0)
  • WarrenBelz Profile Picture
    155,291 Most Valuable Professional on at

    Hi @bs-dev001 ,

    I assume the date is relevant as well? If so, on the Save button

    If(
     !IsBlank(
     LookUp(
     CardKey,
     KeyNumberField = CardKeyDropdowen.Selected.xxxx &&
     DateField = Today()
     ).KeyNumberField
     ),
     Notify(
     "Card already allocated",
     Error,
     ),
     YourSaveCodeHere
    )
    

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • kojima Profile Picture
    108 on at

    If it is a Canvas app, then the formula you mentioned makes perfect sense but this is a model driven app due to the historical reason and relationship with other apps.  Embedding a Canvas app is not a way to go. @WarrenBelz 

  • WarrenBelz Profile Picture
    155,291 Most Valuable Professional on at

    Hi @bs-dev001 ,

    I do not use these unfortunately, but was not aware that this simple formula was not relevant there. I will be mindful of this as I try to restrict the posts I answer to ones I believe I can assist on.

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 April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,027

#2
Valantis Profile Picture

Valantis 644

#3
11manish Profile Picture

11manish 626

Last 30 days Overall leaderboard