cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BenDonahue
Skilled Sharer
Skilled Sharer

How to patch a user into a LookUp column in a UserLog in SharePoint List

Unless it is a horrible idea, I would like to patch my users presence in a UserLog. I could grab their email, ID or whatever, but it might be better to put their identifying information into a LookUp column.

 

How is this done?

 

This has not worked:

 

 

Patch(DDLUserLog, 
    Defaults(DDLUserLog),
    {
    UserLookUp: {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
                        ID:Office365Users.MyProfileV2().id
        }
    }
);

 

 

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @BenDonahue ,

Unless you really need those field types (People and Lookup), it is much simpler to simply store the data you want as Text (and saves a lot of grief later when you want to Filter/Sort/Lookup/GroupBy/Patch on them in Power Apps).

You can however use the Office365User connector in Power Apps to get this information. Bear in mind that User().FullName and User().Email are available directly in Power Apps.

 

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.

Visit my blog Practical Power Apps

View solution in original post

3 REPLIES 3
WarrenBelz
Super User
Super User

Hi @BenDonahue ,

I do something similar tracking logins

Patch(
   DDLUserLog, 
   Defaults(DDLUserLog),
   {
      UserMail: User().Email, 
      LoginTime:Now(),
      AppUsed:"WhateverApp"
   }
)

 

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.

Visit my blog Practical Power Apps

If I am interpreting correctly, you are using one list to track logins for all apps. I like it. I was going to create app-specific lists, but I like your approach better. 

 

If you would, do you know of a way to store an Office365Users user into a SharePoint field? I assume that would be a LookUp column. Also, I am assuming this is possible; it may not be. Instead of storing a user's email or ObjectID, storing their profile may open avenues for me previously closed, but it might bog down the whole process, for all I know.

 

Thank you, Warren, as always 🙂

Hi @BenDonahue ,

Unless you really need those field types (People and Lookup), it is much simpler to simply store the data you want as Text (and saves a lot of grief later when you want to Filter/Sort/Lookup/GroupBy/Patch on them in Power Apps).

You can however use the Office365User connector in Power Apps to get this information. Bear in mind that User().FullName and User().Email are available directly in Power Apps.

 

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.

Visit my blog Practical Power Apps

View solution in original post

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, 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!

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