cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Dynamically change if a DataCard is required based on table selection.

Hello Community!

 

I am relatively new to the PowerApps world but am looking to learn quickly and as I am working on a SharePoint form I ran into a small snag.  The datasource has a few required fields and several that are not required.  I figured I could go in behind the scenes and use an if statement to determine if the field is required based on the Selected.Value from my table.  See the formula below, it just doesn't seem to be making the fields required as expected!  Any advice that can be provided would be greatly appreciated!  The formula seems to work fine for visibility, but for the life of me I can't get it to work for "required."  I have tried re-creating the data source with the fields marked as both required and not required!

 

If(EscalationReason.Selected.Value = "Incorrect Item", true, false)

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Dynamically change if a DataCard is required based on table selection.

Hi @JacobMG ,

Could you please share a bit more about your scenario?

Do you want to change the Required property of Data cards in your Edit form based on the selected option?

 

Actually, the If formula you provided would only work for these Non-Required fields in your Edit form, it could not work for these Required/Mandatory fields from your SP List.

The fields required permission of the Edit form is essentially inherited from your SP List itself. If these fields are already marked as "Required" in your SP List, even though, you change Required property of this required field data card to false, you would still be prompted to provide a value for this required field when you submit your form data.

Please apply your If formula to these Non-Required fields in your Edit form rather than these Required fields. Set the Required property of these Non-Required field data cards in your Edit form to following:

If(EscalationReason.Selected.Value = "Incorrect Item", true, false)

 

If you want to detect if all Required fields in your Edit form has been provided with proper value when you submit your form data, I think the EditForm1.Valid formula could achieve your needs. Please set the OnSelect property of "Submit" button to following:

If(
   EditForm1.Valid = false,
   Notify("Please provide proper value for all Required fields in your Edit form", NotificationType.Error),
   SubmitForm(EditForm1)
)

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Highlighted
Community Champion
Community Champion

Re: Dynamically change if a DataCard is required based on table selection.

Hi @JacobMG ,

If you want to test if a user has completed a field you want to be required, do this on the Save before the submit form - something like

If(
   IsBlank(YourControlName),
   Notify("The field xxxx is required - please complete it",NotificationType.Error),
   SubmitForm(YourFormName)
)

 

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.

Highlighted
Community Support
Community Support

Re: Dynamically change if a DataCard is required based on table selection.

Hi @JacobMG ,

Could you please share a bit more about your scenario?

Do you want to change the Required property of Data cards in your Edit form based on the selected option?

 

Actually, the If formula you provided would only work for these Non-Required fields in your Edit form, it could not work for these Required/Mandatory fields from your SP List.

The fields required permission of the Edit form is essentially inherited from your SP List itself. If these fields are already marked as "Required" in your SP List, even though, you change Required property of this required field data card to false, you would still be prompted to provide a value for this required field when you submit your form data.

Please apply your If formula to these Non-Required fields in your Edit form rather than these Required fields. Set the Required property of these Non-Required field data cards in your Edit form to following:

If(EscalationReason.Selected.Value = "Incorrect Item", true, false)

 

If you want to detect if all Required fields in your Edit form has been provided with proper value when you submit your form data, I think the EditForm1.Valid formula could achieve your needs. Please set the OnSelect property of "Submit" button to following:

If(
   EditForm1.Valid = false,
   Notify("Please provide proper value for all Required fields in your Edit form", NotificationType.Error),
   SubmitForm(EditForm1)
)

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Community Champion
Community Champion

Re: Dynamically change if a DataCard is required based on table selection.

Hi @JacobMG ,

A couple of paths for you here - please tag whoever you want to continue the thread with.

Highlighted
Frequent Visitor

Re: Dynamically change if a DataCard is required based on table selection.

@v-xida-msft 


Thank you for the insight, I am going to need to do some testing regarding the EditForm1.Valid function. 

 

Regarding the list issue I thought that might be the case so I had created two separate lists one with required fields and one with no required fields.  The problem was that even the list with no required fields was allowing the form to be saved even when the required value should have been true based on the table selection.  

Highlighted
Frequent Visitor

Re: Dynamically change if a DataCard is required based on table selection.

Actually I think the change from required to not required on my list did fix the issue.  Though I swear when I posted this original message it hadn't (I had searched for the topic before posting my message)  Thanks for the help everyone 🙂

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (802)