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 / Update a Field with Cu...
Power Apps
Unanswered

Update a Field with Current DateTime via Button

(0) ShareShare
ReportReport
Posted on by 68

Hello everyone, happy to be here!

 

I'm new on PowerApps and I'm struggling with an issue for hours now.

I want to set a field value to the current date & time via button. This field is a table field and I want to update it for each row I'm pressing the button.

 

Here is my code:

 

 

Set(CurrentDateTime, Now());
Update(ThisItem.Submitted, CurrentDateTime);
Refresh(expenses)

 

 

And here is a screenshot to understand my issue better:

 

ndionysiadis_0-1672780090976.png

 

Thanks in advance!

 

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    Hi @ndionysiadis ,

    You should just need

    Patch(
     SPListName,
     ThisItem,
     {Submitted: Now()}
    )

    and should not need to refresh.

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • ndionysiadis Profile Picture
    68 on at

    Thank you for your anwer!

     

    This is what I'm getting as errors:

     

    1) The function 'Patch' has some invalid arguments.

    2) Invalid argument type (DateTime). Expecting a Record value instead.

    3) Cannot use a non-record value in this context: 'ThisItem.Submitted'.

     

    And this is the code:

    Patch(
     expenses,
     ThisItem.Submitted,
     {Submitted: Now()}
    )

    ndionysiadis_0-1672783673393.png

     

     

  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    @ndionysiadis ,

    What type of field is Submitted - it should be date/time

  • ndionysiadis Profile Picture
    68 on at

    It is date/time

     

    ndionysiadis_0-1673269811797.png

     

  • ndionysiadis Profile Picture
    68 on at

    I've made it with this code:

     

    Patch(
     expenses,
     ThisItem,
     {Submitted: Now()}
    )

     

  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    @ndionysiadis ,
    That is exactly what I posted in my first response

  • ndionysiadis Profile Picture
    68 on at

    I can't mark it as solution, why?

  • Verified answer
    WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    @ndionysiadis ,

    I assume you managed to do so (it is now marked)

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard