web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch inside If Statem...
Power Apps
Answered

Patch inside If Statement returning error, expecting boolean

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

My Formula:

 

 

ForAll(
 Gallery4.AllItems,
 If(
 IsBlank(Slot1),
 false,
 Patch('OneEng Candidates_Interviewers', Defaults('OneEng Candidates_Interviewers'), {Interviewer:Interviewer})
 )
)

 

 

I'm getting the error: Invalid argument type (Record). Expecting a Boolean value instead.

 

Why is the If() statement expecting a boolean value? I thought you can nest Patch() functions inside an If() statement 

Categories:
  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

     

    ForAll(
     Gallery4.AllItems,
     If(
     !IsBlank(Slot1),
     Patch('OneEng Candidates_Interviewers', Defaults('OneEng Candidates_Interviewers'), {Interviewer:Interviewer})
     )
    )

    should fix it.

     

  • morall Profile Picture
    Microsoft Employee on at

    that worked, can you explain why this solution works but not the one I wrote? 

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @morall 

    Sure, it's the logic.  IsBlank(Slot1) reduces to either true or false so the If() formula looks to the next element to see what action to take.  Your formula would have worked if you reversed the order of "false" and "Patch(..." ie.

     

     If(
     IsBlank(Slot1),
     Patch('OneEng Candidates_Interviewers', Defaults('OneEng Candidates_Interviewers'), {Interviewer:Interviewer}, 
     false
     )
    )

     

    the false is unnecessary because if IsBlank(Slot1) is false, the If statement, as written above, would conclude without doing anything anyway but it doesn't do any harm to leave it in.  smile.gif

     

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 352 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 323

#3
Mohsin Ali Profile Picture

Mohsin Ali 226

Last 30 days Overall leaderboard