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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Validate creating reco...
Power Apps
Suggested Answer

Validate creating record in Dataverse table from a model-driven app, using a Power Automate flow.

(1) ShareShare
ReportReport
Posted on by 5
I have this model-app driven app and I'm validating for special conditions to decide whether or not to save the record, using a Power Automate flow. Conditions work fine and I was able to make flow triggered appropriately when creating record. And when appropriate conditions (validations) are not met, I've tried a couple of approaches as found in forums:
 
* Use a Return response to PowerApps action
* Terminate the flow
 
which should namely prevent the add record action to finish.. But although I can see flow is indeed executed, and terminated, Power App will still save the record. Being a model-driven app, is there a way to achieve this sort of validation? I used Power automate as last resort after trying with calculated fields, but it didn't work and now I'm stuck. 
 
Appreciate the help.
 
 
Categories:
I have the same question (0)
  • Suggested answer
    abc 123 Profile Picture
    784 Moderator on at
    I'd have to expect that the actions of calling the Flow, and then the Save, although sequential in the code, would work asynchronously. So, the Flow fires, then the App code goes to the next step, and fires the Save immediately, not caring that the Flow is executing. 
     
    If you're married to the Flow, then maybe have a flag variable that enable/disables the Save button until the Flow is complete. (I don't like this, as Flow can take several minutes to trigger, and then you'd have to have really great error handling to ensure it doesn't hang up and time up, leaving the form user perplexed as to what's taking so long.)
     
    I'd think that you'd need to perform the validations in the PowerApp, and then disable/enable the Save button based on the user entries in the form, for the best enduser experience.
     
     
  • DH-11100057-0 Profile Picture
    5 on at
    Thanks so much for suggestion. I'm pretty new to Power Apps and Power Automate but I think what you say is exactly what's happening (app and flow working asynchronously). So in my understanding, yes I'm kind of married to the flow, but just because I wasn't able to find another way to validate creating a record by finding out whether another record exists or not in the same table meeting specific conditions (and that's not a simple duplicate validation, which I already enabled as well). Maybe I'm just not doing looking into the right place.
     
    Just complementing what I want to achieve, if this was a MS Access form validation, I'd be running a simple query over same table just before saving the current record. If any result found, cancel event to save record (DO NOT save record), otherwise, go ahead and save it.  I know it's simplistic, but you get the idea.
     
    I thought of somehow replacing command bar Save&Close button with one of my own where I could trigger flow in sequence (synchronously), but it seems like being a model-driven app, button is not customizable and can't be hidden. Or at least I wasn't able to find out how to do that. 
     
     
     
    I agree the simplest would be to perform validation in PowerApps but, would you please provide some ideas on how could I do that sort of validation from inside the PowerApp itself? 
     
     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 740 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 342 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard