Showing results for 
Search instead for 
Did you mean: 
Level 8

Error with Patch and RemoveIf (which are both accepted individually) in If statement


Please be so kind as to read my full post before responding.
Thank you for your consideration.

I have a strange problem/error (and an easy workaround) with an If formula.
If I put in my then (a Patch formula) and my else (a RemoveIf formula) block, I get an error.

If I split the If into two individual formulas, one each for then and else, I get no errors.
I also use this as an easy workaround.
I don't need help.
I just want to file a "bug" report and maybe get some feedback, preferably from a backend developer, why this "bug" shows up in the first place.

I am assuming that this is some kind of weird bug with the parsing/App-Checking of Patch/RemoveIf in the same If.

For some background info:
I am working on an App for which regular CRM (not customizers!) are supposed to be able do define a variable number of questions (custom entity "WelcomeApp Questions") with a variable number selectable options (custom entity "WelcomeApp Question Options" including LookUp to "WelcomeApp Questions") to ask participants (custom entity "WelcomeApp Participants") of workshops.

The App displays a Gallery of this custom entity.
The gallery template includes just a CheckBox, with the entity label as text, and if the user has selected the option as Default.
The check itself is explained a few lines down.

For the option selection, I use the standard fake-m:n-relationship pattern, i.e. another custom entity "WelcomeApp Participant Answers" which includes one LookUp to "WelcomeApp Options" and one LookUp to "WelcomeApp Participants" (and some additional info like selection time etc).

In Screen.OnVisible, I collect all the options, and also check if the participant has selected it, i.e. there's one record in "WelcomeApp Participant Answers" linking them.
The code in which I noticed my "bug" is from my Save button.
It checks if the CheckBox Value differs from the (previous Default) record(s) in the CRM.
If yes, and the CheckBox is selected, a new record in "WelcomeApp Participant Answers" is created.
If yes, and the CheckBox is not selected, the old record in "WelcomeApp Participant Answers" linking that particular participant to that particular option is removed.

Thank you,

Community Support Team
Community Support Team

Re: Error with Patch and RemoveIf (which are both accepted individually) in If statement

Hi @SaWu ,

Thanks for your sharing. If you have any questions about PowerApps, please feel free to reply here, I would provide a proper workaround for you.


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.

Helpful resources


Power Apps Super User Class of 2020

Check it out!


New Badges

Check it out!


Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!


Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020


Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (4,664)