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

Really want to show your appreciation? Buy Me A Cup Of Coffee!
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

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@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

Really want to show your appreciation? Buy Me A Cup Of Coffee!

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

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,903)