I am working to create a personal note where last edited will record a last time a user edit or change something in the note. I was able to crated a time base on change, but the issue is when Glide system time change, it changed automatically my last edit as well so I am not sure how to resolve that.
Please help.
Here is the code that record any change in the column: const note = p1;
if (!note || note.trim() === “”) {
return “”;
}
const now = new Date();
return now.toLocaleDateString(“en-US”, {
month: “short”,
day: “numeric”,
year: “numeric”
}) + " • " + now.toLocaleTimeString(“en-US”, {
hour: “numeric”,
minute: “2-digit”
});
Your javascript is a computed column and will recalculate every time you open the screen or edit something in the row. It is not specifically tied to changing your note. (A math column that returns Now would essentially give the same result.). In any case, that date is not a stored value. It’s a value thats recalculated every time it’s needed. What you need is value that gets stored in a Date column, but to do that you need an action to be triggered. You could add a button, but there is no enforcement for the user to click the button or to prevent them from clicking it multiple times without chasing the note. You could use an Edit Form instead, which would require you to submit the form to save the note and include the current date with the submission, or what I would do is create a Custom AI component for recording notes, and ask the AI to also write the last updated date to another Date column. That way the date would only change when you modify the note text.
Thank you for the clarification, so if I do understand, the is no way to save a timestamp with a change of an object like note, only with action components or form?
Correct. You need something that can run an action to store a value in a column other than the one that is storing your note. The custom AI component on the other hand can do things that native glide components cannot.