At DevCon 2018, Molly Connolly led a session on data cleaning. During that session, there was a question of how to import data without updating the Modification timestamp. The goal is to display when a user last modified a record, not the developer.
Two methods* of doing that were mentioned but there is another, more robust, answer.
It’s simple and flexible: create an additional field that references the Modification Timestamp field and set a variable flag when you don’t want to update it.
Let’s call the default modification timestamp field “ModificationTimestamp”. Then the new timestamp field should be an auto-enter calc with the calculation of:
If ( $autoEnterOff ; Self ; ModificationTimestamp )
Then, at the start of the the Import script, set $autoEnterOff to True.
- It’s simple
- You never have to modify field definitions after the initial set up
- You never have to modify scripts after the initial set up
- It’s local to the current session. Other users won’t be affected.
- You can use this in other scripts, such as a scheduled server script that performs a nightly update.
- You can use a global variables $$autoEnterOff instead or in addition to script variables and perform developer hand-edits.
*There were two other options discussed during the session.
One to actually turn off the auto-enter option before the import and then turn it on again afterwards. I would strongly recommend against getting into changing a field definition on a live file. Plus user modifications that happen while you’re importing won’t be logged.
The second way is to change the Import options to not use auto-enter options. That can be complicated by wanting some auto-enter options to fire, especially when adding new records (for primary key options).
I can also imagine a more complicated scheme that involves multiple imports, or exporting timestamps and importing, etc. But why bother? The above method is simple with no drawbacks except an additional field.
Additionally, you can display the user account that wasn’t a developer who last modified a field by changing the ModifiedBy field. Uncheck the auto-enter AccountName option and change the field to an auto-enter with a calculation of: If ( $autoEnterOff ; Self ; ModifiedBy ) where ModifiedBy is the default auto-enter “Modification Account Name”.