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 / Set automatically date...
Power Apps
Answered

Set automatically date fileds

(0) ShareShare
ReportReport
Posted on by 15

Hello Guys

 

I have created a CRUD form connected to an Excel online file (that it will be moved to a Sharepoint list, I'm just designing the app) and it has 2 date fields that I need to work in the next way:

 

Creation date: stores the date and time automatically when the form is submitted. It will never change.

Modification date: updates the date and time everytime a user edits a register.

 

I was trying to use the next statement in the Default value for each field:

 

Creation date: If(Form1.Mode = FormMode.New;Now())

Modification date: If(Form1.Mode = FormMode.Edit;Now())

 

This partially works, however the problem is that when the user edits a form, the "Creation date" field gets erased. How can I complete the statement in a way that leave the field as it is (leave it untouched) in case the condition is not fulfilled.

Categories:
  • Verified answer
    WiZey Profile Picture
    3,023 Moderator on at

    Hello @juandroid ,

     

    SharePoint list already provides a "Creation date" and "Modified date", so if you're planning to change your datasource form an Excel to a SharePoint list then you don't really need to meddle with those dates.

     

    Back to your issue, your "creation date" default value only check if the form is in "new mode". You should change your "If()" to set the default value to the "creation date" of the edited item when the form is not in "new mode".

     

    If(Form1.Mode = FormMode.New;Now();Parent.Default)

     

  • juandroid Profile Picture
    15 on at

    Hello @WiZey 

     

    It worked perfectly! Thanks for the answer. Regarding the Sharepoint list, how can I set those 2 date columns to work like that? It's going to be my first time that I use a sharepoint list as a database so I don't know the process.

     

    Thanks in advance!

  • WiZey Profile Picture
    3,023 Moderator on at

    Hello @juandroid ,

     

    You don't have to to anything, those two columns are automatically updated by SharePoint itself. 

     

    Everytime you create a new item, be it a new element in a library of documents or a line in a list, SharePoint will fill in the "Created" date column with the datetime of creation. At the same time, whenever you update an element then SharePoint will change the "Modified" date column to the current datetime. 

     

    SharePoint also fill in the user who created/updated the element if you need it.

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 223

Last 30 days Overall leaderboard