Showing results for 
Search instead for 
Did you mean: 
Helper V
Helper V

Trying to patch a column value based on another column using IF and Lookup

Hi Experts,

I am trying to patch a value of the column 'VewFilter' (single line text) on the basis of a Customer Column ( multiple person) using below formula: I want if the user email id of the person who is logged-in is present in Customer Column, then ViewFilter should be filled with true and otherwise false. This value will change with every user who tries to log-in the app.


If(LookUp(CompletedProjects,User().Email in Customer.Email), Patch(CompletedProjects, CProjects_Gallery1.Selected, {ViewFilter:true}),Patch(CompletedProjects,CProjects_Gallery1.Selected, {ViewFilter:false}))


above formula was used on select of submit button outside of the form

giving the below error


If there is anyother way to implement this criteria also, please help



try something like this:

Patch(CompletedProjects, CProjects_Gallery1.Selected, {ViewFilter:If(LookUp(CompletedProjects,User().Email in Customer.Email,true,false)})
Community Support
Community Support

Hi @IMathur :

Could you tell me:

  • What is your data source?Is it a SharePoint list?
  • What is Customer's data type?Is it Person or Group?

I assmue Customer's data type is "Person or Group".

Firstly,let me explain why you encounted this problem.

1\The first parameter of the If function should be a Boolean value,but the result of "LookUp(CompletedProjects,User().Email in Customer.Email)" is a record.

2\This formula("LookUp(CompletedProjects,User().Email in Customer.Email)") is not delegable.

Secondly,please try this code:


If(!(IsBlank(LookUp(CompletedProjects,"i:0#.f|membership|"& User().Email = Customer.Claims))), Patch(CompletedProjects, CProjects_Gallery1.Selected, {ViewFilter:true}),Patch(CompletedProjects,CProjects_Gallery1.Selected, {ViewFilter:false})) 


In addition, this formula cannot be delegated, so the delegation warning cannot be eliminated.

Best Regards,


Hi @v-bofeng-msft ,


Thanks a lot for the reply!

I want to know, can this formula be implemented in the 'OnStart' property of App, reason being i am using the view filter column to visible the true records to the user who is logged -in and can't see items whose 'viewfilter' value is false, and this will change whenever a new user logs in. So i want this value to be updated as soon as the user start the app. 


Also this is the only way i can think for user visibility management of the items in the sharepoint list, if you feel there is a better way to implement this, please tell that..



Hi @IMathur :

Yes,this formula can be implemented in the 'OnStart' property of the App.

I suggest you replace “CProjects_Gallery1.Selected”, because Gallery selects the first record by default when loading the app.

Best Regards,


Hi @v-bofeng-msft ,


I tried the formula in App> Onstart> If(!IsBlank(LookUp(datasourcelist,"i:0#.f|membership|"& Customer.Email= User().Email).Customer), Patch(datasourcelist, {ViewFilter:true}),Patch(datasourcelist, {ViewFilter:false}))


It is not giving any error and it is not running/working as well. please help..

Hi @IMathur :

Patch(datasourcelist, {ViewFilter:true}) has a syntax error. You should specify a baserecord to update.I think this link will help you a lot:


Such as:


Patch(datasourcelist, First(datasourcelist),{ViewFilter:true})




Patch(datasourcelist, Lookup(datasourcelist,XX=XX),{ViewFilter:true})


Best Regards,



Helpful resources

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (2,770)