cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lparkerMDVIP
Helper III
Helper III

Need PowerApps to Enforce Validation before submitting to SharePoint List

Hello All!

 

In my SharePoint List, I have two fields, Tag and EquipmentStatus. Before a item can be submitted to the list, validation must be passed. Here's the formula on my PowerApps button (DisplayMode property) :

 

LookUp(
'Loaner Equipment Deployment',

'Tag' in Tag.Text && EquipmentStatus = "Open",

DisplayMode.Disabled)

 

"If the tag already exists somewhere else in this column and if the equipment status equals Open, then display a disabled Submit button"

 

However, since we turned off unique values for the tag, you can fill out the form still and click the SAVE button (instead of submit) to submit data to the list. (We want users to submit records with an already used tag, but only if the equipmentstatus column is closed and setting unique values on Tag would prohibit that.)

 

Overall, PowerApps is working find, but the save button bypasses the powerapp functionality.

 

Any help with be appreciated!

8 REPLIES 8
rubin_boer
Super User
Super User

hi @lparkerMDVIP from your requirement would 

If(

  IsBlankOrError(LookUp('Loaner Equipment Deployment',Tag = Tag.Text).EquipmentStatus) ||

  LookUp('Loaner Equipment Deployment',Tag = Tag.Text).EquipmentStatus = "Close",
 DisplayMode.Edit,
 DisplayMode.Disabled
)

 

do it for you?

RandyHayes
Super User III
Super User III

@lparkerMDVIP 

Please consider changing your Formula to the following:

If(
   LookUp('Loaner Equipment Deployment',
      ('Tag' in Tag.Text) && (EquipmentStatus = "Open"),
      true
   ),
   Disabled,
   Edit
)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes
lparkerMDVIP
Helper III
Helper III

@rubin_boer @RandyHayes Thank you both for your input, but all 3 of our formulas take care of the PowerApps button displaymode, but the default SharePoint SAVE button can still be used to bypass the formula.

RandyHayes
Super User III
Super User III

@lparkerMDVIP 

Change the formula on the OnSave action of the SharePointIntegration object.

The default will just SubmitForm.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

@RandyHayes Place your formula on the OnSave action?

RandyHayes
Super User III
Super User III

@lparkerMDVIP 

No, not place the formula in the OnSave action....

What is your OnSave action formula now?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Right now, OnSave = SubmitForm(SharePointForm1)

RandyHayes
Super User III
Super User III

@lparkerMDVIP 

Yes, and I am stating that this will bypass the logic you are trying to put on a save button.

You need to do one of several things:

1) Disable the default Save button - okay, that was a joke because you can't do it, but you can augment it with a PopUp that would let the user know to use your new save button.

 

2) Change the formula in the OnSave to acknowledge the displaymode of your save button.

  If(yourSaveButton.DisplayMode = Edit, SubmitForm(SharePointForm1))

 

3) Just don't do anything if they hit save - remove the formula in the OnSave

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (68,622)