cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
thatakke
Helper II
Helper II

Why can't I patch users' location?

Hello,

 

I'm building a phone book app that has a location field that's being automatically filled from the directory:

 

Office365Users.MyProfileV2().country

 

I'm trying to patch this information to SharePoint list. It's a long patch command, and everything else is working, but the country field. I can't figure out why the country field is not being patched. 

 

Patch(Defaults('SP List'),
{
/all the other fields/
LocatedCountry:CountryLabel_1.Text
}
)

I'm also populating the username, job title, department etc. fields automatically from the directory, everything seems to be the same but for some reason, this field is not being patched. What am I missing here?

 

Thanks,

1 ACCEPTED SOLUTION

Accepted Solutions
Harrison_Ellem
Helper I
Helper I

Hi,

 

@thatakke try this code

Patch(Defaults('SP List'),
{
/all the other fields/
'LocatedCountry: Country/Region': CountryLabel_1.Text
}
)

i hope this helps

View solution in original post

13 REPLIES 13
JR-BejeweledOne
Super User
Super User

A quick question

 

I am presuming that you can see the Country value in the label so what kind of field is LocatedCountry?

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

Thanks @JR-BejeweledOne 

It's correct, I can see the country values in PowerApps.

LocatedCountry is a regular text column in SharePoint. As I mentioned, I can actually patch the rest of the fields, for some reason, location is failing to get to SharePoint.

 

Cheers,

Hi @thatakke ,

 

Its not a good practice to patch values of the control directly in the Patch as sometimes it tends to reset before the Patch is performed. 

I would suggest to give the formula instead for control value in the Patch code. You can try the something like below if it helps in your case. 

 

Patch('SP List',Defaults('SP List'),
{
/all the other fields/
LocatedCountry:Office365Users.MyProfileV2().country
}
)

 

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.

If this post was helpful or you need more help please consider giving Thumbs Up and Tag me in your reply I'll be happy to help. If this post helped you solve your issue please click Accept as solution and provide Thumbs Up. This will help others find it more readily.

Many thanks @PG_WorXz10 

 

This is exactly what I tried this morning, but it still is not Patching the information to the column. It's curious, because even when I change the field to another field that is already being patched, it's not working. To clarify, I set up a variable called "appuser" that grabs User() OnStart of the app and changed the above command to:

LocatedCountry:appuser.Email

 

Just to test what's wrong, as "appuser.Email" is already patched to another column called "Email" but, still I'm not getting anything. Should I remove the LocatedCountry column totally and re-create everything?

 

Thanks,

Hi @thatakke 

 

What is column type of LocatedCountry  is it a choice column or lookup column ?

If this post was helpful or you need more help please consider giving Thumbs Up and Tag me in your reply I'll be happy to help. If this post helped you solve your issue please click Accept as solution and provide Thumbs Up. This will help others find it more readily.

thatakke
Helper II
Helper II

It is a regular text column, which is exactly the same as the "Email" column:

thatakke_0-1632298982680.png

 

Hi @thatakke ,

 

Is it by any chances Title column converted to LocatedCountry ?

If this post was helpful or you need more help please consider giving Thumbs Up and Tag me in your reply I'll be happy to help. If this post helped you solve your issue please click Accept as solution and provide Thumbs Up. This will help others find it more readily.

That was a great guess that made me excited for a second, but as far as I can see, I've never touched the Title column, as I've messed up things in the past.

Hi @thatakke ,

 

Did you tried adding hardcoded values in your patch method for this column. Also if you don't mind could you please share the your whole patch method to check if something we missed in the code ? 

If this post was helpful or you need more help please consider giving Thumbs Up and Tag me in your reply I'll be happy to help. If this post helped you solve your issue please click Accept as solution and provide Thumbs Up. This will help others find it more readily.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

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