web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / store user() to ShareP...
Power Apps
Answered

store user() to SharePoint list person column

(0) ShareShare
ReportReport
Posted on by

I am trying to record the current user, how many times he/she used the app, and the last time he utilitzed the app.

 

My SPO List:

AppUser (Title:Text  Person:PeoplePicker  Usage:Int  LastUsed:Date)

 

And I currently have it implemented like this:

 

Screen.OnVisible

Patch(AppUsers, Defaults(AppUsers), {Title:User().Email, LastUsed:Now(), Usage:0})

 

Button.OnSelect

UpdateIf(AppUsers, Title = User().Email, {Title:User().Email,  LastUsed:Today(), Usage:Usage+1})

 

Two questions:

1.  How can I use the User() to populate the "Person" field in the SharePoint List? 

2.  How can I combine both actions above into one?

        ie( Check if User() is not in the list,  add the user to list and set his usage to 1, else increment the usage by 1.

This syntax does not work:

       Patch(AppUsers, Defaults(AppUsers), {Title:User().Email, LastUsed:Now(), Usage:Usage+1}     

 

 Thanks.

Tom

 

 

 

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    v-yamao-msft Profile Picture
    on at

    Hi tChmiel,

     

    According to your description, I created a similar SharePoint list with you, say ListC.
    Then created a connection from PowerApps to this list.
    On the app, I configured the OnVisible property of the screen as:

    If(User().FullName in ListC.Title,UpdateIf(ListC,Title=User().FullName,{LastTime:Now(),euru:euru+1}),Patch(ListC,Defaults(ListC),{Title:User().FullName,LastTime:Now(),euru:0}))

    When I navigate to this screen, the item would be updated or a new item would be created.

     

    PS: About Usage column, it was named as “Usage” in the list, but on the app, I was asked to use the name “euru”. So please make sure you were using the valid column name.

     

    Hope my code could be a reference for you. And these documentations for your reference:
    https://powerapps.microsoft.com/en-us/tutorials/function-if/
    https://powerapps.microsoft.com/en-us/tutorials/control-screen/


    Best regards,
    Mabel Mao

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard