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,

13 REPLIES 13

Hi @PG_WorXz10 I'm quite new to PowerApps (as you will see from my post history here) so I don't know what you mean by hardcoding values. Can you clarify?

 

I'm sharing the patch command below, but it can be a little confusing as a whole, so I added //comments// for you. As you can see below, I have problems with 3 fields, and I chose to use different methods for each. For example, for the ManagerName, I created a separate label called "ManagerLabel", made it invisible, and changed its value to 

Office365Users.Manager(User().Email).DisplayName

 

and decided to patch the label's text value. It still doesn't work.  As mentioned, as a test, I changed my country field's fill-in info to appuser.Email, which is supposed to show the active user's mail address.

 

If(
    Checkbox1_1.Value=false, Notify("You need to confirm the selection"),
    Checkbox1_1.Value=true, //This is just to check whether people selected I confirm it's true//
        Patch(
        'SPList',
            If(
            IsBlank(LastCreatedID),
            Defaults('SPList'),
            LookUp(
                'SPList',
                ID=LastCreatedID //This was created thanks to this community. It checks whether people are already in the SP list or not//
            )
        ),
        {
            NameofthePerson: appuser.FullName,
            Job: JobTitle.Text,
            Email: appuser.Email,
            PrimaryLanguage: DataCardValue52.SelectedItems,
            Gender: DataCardValue14.Selected,
            Dateofbirth: DataCardValue37.SelectedDate,
            LocatedCountry: appuser.Email,
            CityLocation: Office365Users.MyProfileV2().city,
            ManagerName: ManagerLabel.Text, //These 3 fields are not patched to SP list. All the others, including the ones I removed from this example go through//
            },
        ProfileForm.Updates,
        WorkForm.Updates,
        SkillForm.Updates,
        SummaryForm.Updates //I've 3 forms where people enter info, and the summary form shows a summary of the info submitted. It also allows editing aldready submitted info//
    )
);
If(Checkbox1_1.Value=true, Notify(
    "Uploading") &&
    Navigate(Success,ScreenTransition.UnCoverRight))

 

Hi @thatakke ,

 

Please try adding hardcoded value to check if there is any issue with the column itself. If hardcoded value is not getting patched I would suggest try deleting the column and adding it again.

 

  CityLocation: "Testing"

 

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.

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

Many thanks @Harrison_Ellem 

 

That totally works! Although I don't understand why the other fields didn't need such an edit. 

 

Many thanks,

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

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