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 / How to conditionally c...
Power Apps
Unanswered

How to conditionally change values when editing SharePoint item

(0) ShareShare
ReportReport
Posted on by 7

Hello,

 

In my PowerApps form I have two choice fields. One choice field is called "problem code" and the other is called "sub category". There are 5 potential problem codes to choose from. The "sub category" choice is hidden and only becomes visible/required when someone selects problem code 1 or 2 in the previous choice. I have the OnChange of the problem code data card set with the following code. 

 

If(ProblemCode.Selected.Value <> "3" Or ProblemCode.Selected.Value <> "4" Or ProblemCode.Selected.Value <> "5", Reset(SubCategory), NoChange).

 

If the user selects 1 or 2 as the problem code, selects a sub category, then changes their mind on the problem code, this clears the selection they made for the sub category. This works great when a new form is being filled out, but if we wish to change the problem code after the form was submitted, it does not make those changes and the item in SharePoint still shows the selected sub category value. When the form is edited, if problem 3,4, or 5 are selected, i would like the sub category to go back to null. Does anyone know how that can be done in PowerApps? I have tried a few things and have had no luck.

 

Thanks in advance,

 

Ben

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,084 Most Valuable Professional on at

    Hi @bennyg28 ,

    The issue with resetting is that the control reverts to it Default value, which I suspect is the field in SharePoint you are trying to clear. So you need something like this on the OnChange of ProblemCode

    UpdateContext(
     {
     varResetSub:
     Self.Selected.Value = "3" ||
     Self.Selected.Value = "4" ||
     Self.Selected.Value = "5"
     }
    )

    At Screen OnVisible

    UpdateContext({varResetSub:false})

    On the Reset of the sub-category control

    varResetSub

    On the Default of this control

    If(
     varResetSub,
     Blank(),
     Parent.Default
    )

    You may also have to turn on Formula Level Error Managment in Advanced Settings for the Blank value to patch properly.

     

    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.

    Visit my blog Practical Power Apps

     

  • bennyg28 Profile Picture
    7 on at

    Hello,

     

    Thank you for the response. This doesn't seem to quite work. When I edit an existing list item with the form, the previously selected value in the sub category column is still there. Are there any other possible solutions?

  • WarrenBelz Profile Picture
    153,084 Most Valuable Professional on at

    @bennyg28 ,

    I am not sure what else to suggest - you need to conditionally reset the second combo box, but is a way that it only does so only on the selection of certain values in the first combo box. You also need to allow for it to display and maintain its existing value it this does not happen. The only other solution would be to get rid of the Update on the card and Patch it on the OnSuccess of the form using the same logic.

     

    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.

    Visit my blog Practical Power Apps

     

     

     

     

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 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard