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 / Pull the username of t...
Power Apps
Unanswered

Pull the username of the user who selected toggle and store it in SharePoint list

(0) ShareShare
ReportReport
Posted on by 35

Hi all,

 

I am new to PowerApps and for the most part, have been able to link our SharePoint Lists to Power Apps and build functionality. I have a SharePoint List that has multiple tasks and each task has its own Task completed by and task completed timestamp columns. I would like the Completed By and Timestamp columns to be view only and the task itself column is a "Yes/No" data type. When the user clicks the toggle in the app for a task, the completed by and date fields in the app (view only) automatically populate with the username and the date the toggle was selected. When the submit button of the form is selected, all 3 selections are written to the SharePoint list. Essentially, one toggle button would therefore create 3 columns of data. I have already formatted the form for the visual I would like, but I cannot get the username and time to auto populate when the toggle is selected. Any help would be appreciated.

 

Buckets_0-1667235218050.png

 

Categories:
I have the same question (0)
  • Tchesco Ayih Profile Picture
    152 on at

    Hi @Buckets 

    Try this on the OnCheck of the toggle add this formula:

    UpdateContext({TaskCompletedBy: User().FullName, ToggleTimeClicked: Now()})

    This will store the Current user name and the time. You can then add those variables to the patch to submit to the SharePoint List.

     

    Hope this helps.

  • Buckets Profile Picture
    35 on at

    @Tchesco 

     

    Question for you, will this show immediately upon the clicking of the toggle or will it just be written to the Sharepoint list on submit?

  • Buckets Profile Picture
    35 on at

    @Tchesco 

     

    Is there a scenario that it will show immediately upon toggle without submit?

  • Tchesco Ayih Profile Picture
    152 on at

    @Buckets 

    The formula does not submit at once to sharepoint, I would like to know more about your process to see how I can help.

    Also is the toggle on a form, in a gallery or alone on the screen.

  • Buckets Profile Picture
    35 on at

    @Tchesco 

     

    The toggle is on a form and is from a Sharepoint List. The toggle is set to TrueText = "Yes" and FalseText = "No". To test various options, I inserted a text label and in the "text" field I wrote:

     

    If('DateCardValue136'.Value = true, User().FullName, "")

     

    This worked and shows my name when the toggle is selected, but I was wondering if a drop down field from the Sharepoint list that houses users can automatically show the user who selected the toggle. Errors that I have ran into are that the drop down is a "table". Essentially, I need the "Completed By" drop down to automatically show the user who clicked the toggle when has been selected. 

  • Tchesco Ayih Profile Picture
    152 on at

    @Buckets 

    You could add a label that will display the user name when the toggle is true and add an edit icon that make the dropdown visible in case you want to select a user from it.

  • Buckets Profile Picture
    35 on at

    @Tchesco 

     

    I was able to get the username to show how I would like, but the issue is that it only shows the current user logged in. For instance, I click the toggle, my name is then written to the form value I want along with the date I clicked the toggle. I click submit. The data is then updated in Sharepoint perfectly. I got that far. The issue is that when another user logs in, it shows their name in the toggle that I selected if they go in and have to update other toggles on the particular record. 

     

    I am trying to find a way that if a value is already documented, parent.default, if not, then when a toggle is selected, update the record with the current user. Many nested if statements I have tried have resulted in circular references so it errors out. 

     

    Any thoughts?

  • Tchesco Ayih Profile Picture
    152 on at

    Ok, validate the column to find out if its blank to make the toggle visible.

    This in the visible property

    If(IsBlank(ThisItem.ColumnName), true, false)

     ColumnName is the column that hold the username.

  • Buckets Profile Picture
    35 on at

    @Tchesco 

     

    The issue I am facing is not really whether the toggle that has already been displayed is visible, but I need the user and date for previous toggles to display the names of the people who completed them, without changing when someone else logs into the app. 

  • Tchesco Ayih Profile Picture
    152 on at

    Hi @Buckets 

    You can put 

    ThisItem.ToggleColumnName

    ToggleColumnName: is the column that the toggle represents in the SharePoint list.

     

    ThisItem.UserName

     UserName: represent the column that hold the user name in the SharePoint list.

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 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard