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 / Timestamp SP List When...
Power Apps
Answered

Timestamp SP List When Button is Clicked

(0) ShareShare
ReportReport
Posted on by 35

Hi All 🙂

 

I am quite new to building power apps and have been on the task to create a project tracker app, a part of this app is a page where different mandatory tasks are necessary to complete when a task is completed the user should press the 'Mark Task As Achieved' button and I would like the date and time to registered in my SP list upon the button being clicked. Currently I have the following code for OnSelect but it does not manage to register the time in the SP list. I would really appreciate some help with this!

 

 

Patch('Project Tracker', Defaults('Project Tracker'), {'M1 Achieved On': Now()})

 

 

Categories:
I have the same question (0)
  • Devvj Profile Picture
    1,132 Super User 2024 Season 1 on at

    Hi @farida_assef ,

    What datatype is the field in SharPoint?
    Try if its a date field 

    Patch('Project Tracker', Defaults('Project Tracker'), {'M1 Achieved On': Date(Now())})

     

    Or this if its a text field

    Patch('Project Tracker', Defaults('Project Tracker'), {'M1 Achieved On': Text(Now())})

     

    -------------------------------------------------------------------------
    If this is the answer for your question, please mark the post as Solved.
    If this answer helps you in any way, please give it a like.
     

  • farida_assef Profile Picture
    35 on at

    Hi @Devvj ,

    In my SP list the data type for that column is date and time. I have used the formula you've provided but I get the following error: Invalid number of arguments, received 1 expected 3.

  • Devvj Profile Picture
    1,132 Super User 2024 Season 1 on at

    @farida_assef 
    It may be that you need to provide SP with more properties, are there any other requried fields in your SP list that you need to add to the patch?


    -------------------------------------------------------------------------
    If this is the answer for your question, please mark the post as Solved.
    If this answer helps you in any way, please give it a like.

  • farida_assef Profile Picture
    35 on at

    @Devvj my list has multiple required field split up in other forms of the app. Do I have to induce them all the in the patch formula as well?

     

    Generally to save the various forms and input the data to the SP I have a save button at the top of the page with the following:

    Patch('Project Tracker',varFormData,BasicDetailsForm.Updates,ScopeForm.Updates,TimelinesForm.Updates,EstimatedSavingsForm.Updates, MilestonesForm.Updates, MilestoneEvidenceForm.Updates, EstimatedSavingsForm.Updates, NegotiatedSavingsForm.Updates, RealizedSavingsForm.Updates);
    
    If(
     IsEmpty(Errors('Project Tracker')),
     Notify(
     "Data successfully submitted",
     NotificationType.Success
     );
     Navigate(HomeScreen),
     Notify(
     First(Errors('Project Tracker')).Message,
     NotificationType.Error
     )
    )

     

  • Devvj Profile Picture
    1,132 Super User 2024 Season 1 on at

    Then I guess you want to patch an existing record and not create a new one?
    If you want to just update the "M1 Achived On" field on an existing record in SP you need to reference the record in your second argument in the patch function instead of Defaults.


  • farida_assef Profile Picture
    35 on at

    Hi @Devvj, essentially I have split up the input required for the SP list to make it more manageable on multiple pages. Just to try and understand the solution you provided in the context of how I want the app to function, would I have to also apply the second patch argument to the 'Mark Task As Achieved' button to register the timestamp when the button is clicked?

  • Verified answer
    Devvj Profile Picture
    1,132 Super User 2024 Season 1 on at

    Hi,
    The powerFX in the first post indicates that you want to create a new item in SharePoint list "Project Tracker", but it seems like you rather want to update a already existing project item with the M1 achived time? 

    Is that correct?

    Since the "Default('Project Tracker)" part in you script means create a new row.

    If you want to update an item you need to pass the item you want to update instead of Default() in the second parameter in the Patch.

  • farida_assef Profile Picture
    35 on at

    @Devvj yes I'd like to update the value in the SP list column regardless of whether there was a value in there previously or not. Now instead for the OnSelect of the 'Mark Task As Achieved' button I have put the following code but it doesn't work and I'm not sure that's the approach I should use 

    Patch('Project Tracker',varFormData,BasicDetailsForm.Updates,ScopeForm.Updates,TimelinesForm.Updates,EstimatedSavingsForm.Updates, MilestonesForm.Updates, MilestoneEvidenceForm.Updates, EstimatedSavingsForm.Updates, NegotiatedSavingsForm.Updates, RealizedSavingsForm.Updates), {M1 Achieved On': Date(Now())})
  • Devvj Profile Picture
    1,132 Super User 2024 Season 1 on at

    There is a ")" before the last parameter that need to be removed atleast, after the "RealizedSavingsForm.Updates"

  • farida_assef Profile Picture
    35 on at

    Hi @Devvj I've made the correction to the formula and re-applied but I still keep getting the same error message that Invalid number of arguments, received 1 expected 3 when it comes to Date(Now()). Do you know why that might be?

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard