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

Patching a User to a Custom Table

Hello you,


I'm trying to patch a user in a custom table. But the user table has no columns...


Sounds tricky here...


So far, I have this. 


Patch(Junction_Idea_Users,Defaults(Junction_Idea_Users), { User_L: Office365Users.UserProfileV2(User().Email).id})


I have the following now : 




Nevermind, fixed it. Wasn't the same columns... 

Super User
Super User


Right!  That is not what I was demonstrating in the suggested formula.  In yours you are trying to set a (presumably numeric) column to a whole record - that is not a compatible type.


Setting that context variable over and over is not the best choice for your app.

If you are showing the Ideas in a Gallery, then you already have the ID of the Idea, so there is no need to look it up again.

For the User, you should look up their ID only OnStart of the app.


So, based on that, first your OnStart would have this:

Set(glbUser, LookUp(Users, 'Primary Email' = User().Email))


And then for the Items property of your should already be using records from the Ideas table.  So no need for lookup there.


Based on all of that, the formula for the OnSelect of the icon should be:

If(Self.Icon = Icon.ThumbsDown,

    Patch(Junction_Idea_Users, {IdeaID: ThisItem.IdeaID, UserID: glbUser.UserID}),

    RemoveIf(yourIdeaUserJunctionTable, IdeaID = ThisItem.IdeaID && UserID = glbUser.UserID)

And the Icon property of the Icon should be:

If(LookUp(Junction_Idea_Users, IdeaID = ThisItem.IdeaID && UserID = glbUser.UserID, true),


I do not know that actual ID/Key from your Idea and User tables, so replace the IdeaID and UserID in the above formulas to the appropriate column with that value.

Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Good evening,


Do you have an alternative solution for this ? 


Patch(Junction_Idea_Users, {IdeaID: ThisItem.IdeaID, UserID: glbUser.UserID}),

 The reason is because you can't access IdeaID or UserId directly as you need to go through the lookup first.



Gotcha! I had to use the contextupdate but it works like a charm!

Small correction on the removeif statement, replace && by And if you do not want the whole list that match either or to be flushed 😛

Helpful resources

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

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