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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / add timestamp to an al...
Power Apps
Answered

add timestamp to an already created item

(0) ShareShare
ReportReport
Posted on by 58

hi,

 

I already created an item in an sp using powerapps and now I need to create two button to insert the start time and end time to this same item.

 

can you help me please ?

Categories:
I have the same question (0)
  • ChrisRoxor Profile Picture
    28 on at

    Do you want to insert the current time/date or do you want a date picker to insert a chosen date to overwrite or add to the sharepoint list?

  • roncam Profile Picture
    58 on at

    insert current time

  • ChrisRoxor Profile Picture
    28 on at

    You can use the Now function to pull the actual date/time and insert where needed.

    See more here:

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-now-today-istoday 

     

    For example, you could have a text input field with it's default set to:

    If(ButtonClicked, CurrentTime, Parent.Default)

    This ensures you get the fresh details, but that it will show any preentered details that might be present beforehand.

     

    Then the button OnSelect properties

    UpdateContext({CurrentTime: Now()});UpdateContext({ButtonClicked: True})

     

    Then whenever you click out, you can update the ButtonClicked to False or Blank() to cancel it out.

     

    I'm sure there might be a "prettier" way but it should work for you.

  • roncam Profile Picture
    58 on at

    i would like to have a button called "Start" when pressed it will update the record with now() time under a particular column in sp and another button named "End" and when pressed will insert the Now() time in another particular column in sp.

  • roncam Profile Picture
    58 on at

    obviously updating the current record

  • ChrisRoxor Profile Picture
    28 on at

    Okay so you're trying to just update directly in sharepoint, and not in a text input field.

     

    You need to use the Patch function in this case:

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch

     

    Syntax:

    Patch( DataSource, BaseRecord, ChangeRecord1 [, ChangeRecord2, … ])

     

    So you'd use BaseRecord as the current field to update, example ThisItem.Record1 and in ChangeRecord1 you'd put Now()

     

    All of this should of course be on the button OnSelect properties

  • roncam Profile Picture
    58 on at

    ThisItem is not working

  • Verified answer
    ChrisRoxor Profile Picture
    28 on at

    You need to have a selected item before you can modify it. Generally if you have a gallery edit page you would pick the item through the Gallery selection page, and then ThisItem should work. 

    If you need to run it as a standalone button without already having pulled the relevant row from SharePoint, you would need to use a function to search by ID or another column with a unique value, to then patch in the now() value.

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @roncam,

    How do you create a new record within your SP list? Using SubmitForm function or Patch function?

    Could you please share more details about the data structure of your SP list?

    Based on the needs that you mentioned, I think the Patch function could achieve your needs. If you want to update an existing record using Patch function, you must find the record you want to update firstly.

    I have made a test on my side, please take a try with the following workaround:

    Set the OnSelect proeprty of the "Start Time" button:

    Patch(
     "YourSPList",
     LookUp("YourSPList", ID = "List Item ID"), /* <-- Find the existing record you want to update based on List Item ID*/
     {
     StartTimeColumn: Now()
     }
    )

    Set the OnSelect proeprty of the "End Time" button to following:

    Patch(
     "YourSPList",
     LookUp("YourSPList", ID = "List Item ID"),
     {
     EndTimeColumn: Now()
     }
    )

    More details about the Patch function and LookUp function in PowerApps, please check the following article:

    Patch function

    LookUp function

     

    Best regards,

    Kris

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 103

#2
WarrenBelz Profile Picture

WarrenBelz 82 Most Valuable Professional

#3
wolenberg_ Profile Picture

wolenberg_ 67 Super User 2026 Season 1

Last 30 days Overall leaderboard