Showing results for 
Search instead for 
Did you mean: 
Post Prodigy
Post Prodigy

Validation on Form Submission

Hi Folks -

I was wondering the best way to go about establishing a validation in PowerApps? Allow me to give the requirements.


I have a table called "rdInvestments" and for purposes of this dicussion, here are the 3 columns from my table and sample data:




AssetID is the PARENT to InvestmentID - think of tree form if this was a hierarchy in a system somewhere.

Now, the Column "PR_Lead_indcation" is where the action happens. Ultimately, there can be ONLY 1 value of "TRUE" for "PR_Lead_Indication" for sibling data elements. And obviously, to determine siblings, you can use the "AssetID" column.


So in the above example, all of the those PFI data elements are siblings with 1 like parent. I need to enable a validation where on both  new requests and edit requests, if someone tries to use a TRUE value when it already exists in it's sibliing group, to not allow it.


I'm not sure if this can be done on the actual field itself or on the Submit button.  Ultiately, I have a validation setup on my target financial application it gets imported into, however I'd prefer to catch the issue in the begining rather than getting a failure to import when I go to load this..Then, I need ot backtrack and then hunt down the end user to get clarity. Enabling the validation on the PowerApps side would save lots of time!


Please let me know your thoughts!


Thank you!




Ah yes...the pictures are worth a thousand words!!


So, I believe here is the issue you are seeing.  When you are creating a new item, ThisItem is blank for the CompoundCode.

So, what you need to do is grab the value that is in the AssetID and not the ThisItem (I think this is the Asset Alias field on your form?).

So, let's say that's a text control...then you would alter the formula to this:

         Filter(rdInvestments, CompoundCode=DataCardValuexx.Text && !(PR_Lead_Indication.Value="FALSE"))
	) >=1 && PR_Lead_Indication.Value="FALSE", Disabled, Edit

If it's a drop-down or some other place that the current CompoundCode is coming from, then just substitute that in the above formula.


This should work equally well on new and edits.

Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!



ThisItem was the trick, I needed to switch per your suggestion.  However, it still wasn't behaving like I needed it to.


Therefore, a couple tweaks and this is what I arrived at and it works as expected:


If(InvestmentEditForm.Mode = New && CountRows(
	Filter(rdInvestments, CompoundCode=DataCardValue41.Text && PR_Lead_Indication.Value="TRUE")) >=1, Disabled, 
	Filter(rdInvestments, CompoundCode=ThisItem.CompoundCode && !(PR_Lead_Indication.Value="FALSE"))) >=1 && PR_Lead_Indication.Value="FALSE", Disabled, 

Thanks again, Randy!! Have a grea holiday weekend!


Ah I see, you needed to look at the other value as well in your statement.  Good deal!  Glad you got to a working point.

Have a great holiday weekend as well.

Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Helpful resources

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.


Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (6,341)