Can you create a field that produces a date/time stamp when a separate field is entered | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Mayank_Gandhi
Mayank_GandhiAccepted solution
Employee
Dec 6, 2022 3:18 PM UTC

@reluctantprogrammer yes via script you can. On the exit of the other field just fire the js to set the value of date time field to set to current date/time

 

today = Num2Date(Date(), "MM/DD/YYYY") //returns date in MM/DD/YYYY format

other_field.rawValue = today // populate my_date_field with todays date

.

7 replies

radzmar
Level 10
Dec 6, 2022 9:26 PM UTC

What are you trying to achive with this exactly?

Translate
ReluctantProgrammer
Level 4
Dec 6, 2022 9:31 PM UTC

basically creation of a "date/time stamp" to show when the user actually entered remarks in a field.  

Translate
radzmar
Level 10
Dec 6, 2022 9:40 PM UTC

Then the code mentioned above will do the trick.

In case you don't want to overwrite the date once it has been set, wrap it into an if statement. Keep in mind the code is in FormCalc not JavaScript!

if (other_field.isNull) then
    other_field = Num2Date(Date(), "MM/DD/YYYY")
endif

 

Translate
Mayank_Gandhi
Mayank_GandhiAccepted solution
Employee
Dec 6, 2022 3:18 PM UTC

@reluctantprogrammer yes via script you can. On the exit of the other field just fire the js to set the value of date time field to set to current date/time

 

today = Num2Date(Date(), "MM/DD/YYYY") //returns date in MM/DD/YYYY format

other_field.rawValue = today // populate my_date_field with todays date

.

Translate
ReluctantProgrammer
Level 4
Dec 6, 2022 9:32 PM UTC

Exactly what I needed...thank you!

 

Translate