Restoring Record Data
What it does
DocMgt keeps a history of every value written to a Record's fields. When a bad import, a misconfigured workflow action, or a user mistake overwrites good values, that history lets you put the earlier values back. For many Records at once, build an Add-In that reads the history with the [DATAHISTORY] variable and writes it back with the Record Multi-Value Update action. For a single Record, an administrator can use Revert Record Data on the Record screen instead, described at the end of this topic.
How [DATAHISTORY] finds an earlier value
The variable takes the form [DATAHISTORY(RecordID|Name|FromDate|ToDate|ChangeNum)] and returns a value the field held at some earlier point.
- RecordID can be left blank. The variable then reads the Record the Add-In is running against.
- Name is the name of the field.
- FromDate and ToDate limit the history to values written inside that range. A date with no time means midnight at the start of that day, so a ToDate of 9/20/2026 covers everything up to the end of 9/19/2026. Dates and times are in the system's time zone.
- ChangeNum picks one value from the history, counting from the newest. The default is 1.
The history holds every value that was written to the field, newest first, and that includes the value the field holds right now. So change 1 is normally the current value and change 2 is the one before it. When nothing in the history matches, the variable returns a blank.
That gives two ways to point at the value you want back.
- Undo the most recent change to the field: [DATAHISTORY(|Amount|||2)] returns the value Amount held before its last change.
- Go back to a point in time: [DATAHISTORY(|Amount||9/20/2026 1:59 PM|1)] returns the value Amount held at 1:59 PM on 9/20/2026, however many times it has changed since.
The point-in-time form is the better choice when you are repairing damage done at a known time, such as an import that ran at 2:00 PM. It returns the right value even if a user edited the field again afterward, where "undo the most recent change" would only step back one edit.
Keeping fields that have no earlier value
If a field has no history from before the point you choose, [DATAHISTORY] returns a blank, and writing that blank back clears the field. To leave such a field as it is, wrap the variable in [FIRSTVAL] with the field itself as the fallback:
[FIRSTVAL([DATAHISTORY(|Amount||9/20/2026 1:59 PM|1)]|[Amount])]
[FIRSTVAL] returns the first value that is not blank, so the field keeps its current value when there is nothing to restore.
[ISNULL] does the same job. It returns its first value unless that value is blank, in which case it returns the second:
[ISNULL([DATAHISTORY(|Amount||9/20/2026 1:59 PM|1)]|[Amount])]
Use whichever you prefer. Leave the wrapper off when you do want fields that were empty at that point to be cleared. Do not use either wrapper on a field whose values can contain the | character, because the character splits the value in two.
Building the Add-In
- In the Add-Ins administration screen, create a new Add-In and give it a clear name, such as Restore Data to 9/20 1:59 PM.
- Under General Settings, set Type to Actions Only.
- Under Where/When to Show, turn on the Search location so the Add-In runs against the Records in your search results. Turn on the Record location as well if you also want to run it on one Record at a time. Use Record Types to limit it to the Record Type that was damaged, and use When to Show to limit it to administrators, because it overwrites data.
- Set the option to Add-In will refresh the Record/Viewer screen after running so the restored values show as soon as it finishes.
- Under Record Actions, add a Record Multi-Value Update action. Add one row for each field to restore: put the field name in Field Name, the [DATAHISTORY] variable for that field in Field Value, and leave Line Number blank.
- Under Confirmation Prompt, add a short warning such as "This overwrites the checked Records' data with the values they held at 1:59 PM on 9/20/2026."
A Record Multi-Value Update action set up to restore three fields to their values at 1:59 PM on 9/20/2026 would have these rows, each with Line Number left blank:
- Field Name Amount, Field Value [FIRSTVAL([DATAHISTORY(|Amount||9/20/2026 1:59 PM|1)]|[Amount])]
- Field Name Status, Field Value [FIRSTVAL([DATAHISTORY(|Status||9/20/2026 1:59 PM|1)]|[Status])]
- Field Name DueDate, Field Value [FIRSTVAL([DATAHISTORY(|DueDate||9/20/2026 1:59 PM|1)]|[DueDate])]
Running the Add-In
Search for the Records that were damaged, check the ones to restore, and run the Add-In from the search results. If no Records are checked, the Add-In runs against every Record the search found. Try it on a single Record first and confirm the values it restores are the ones you expect before running it against the rest.
The restore is itself recorded in each field's history, so if it puts back the wrong values you can undo it the same way, by restoring to a point in time just before the Add-In ran.
Limits
- [DATAHISTORY] reads Record fields only. Line item fields and fields stored on individual Documents are not included.
- The variable looks at no more than the 50 newest values inside the date range, so a ChangeNum above 50 returns a blank.
- Fields whose names start with @ are not tracked, so they have no history to restore.
- If a field holds several values, Record Multi-Value Update writes the restored value to every one of them.
- Reading history can be slow on large, busy systems. Run the restore from an Add-In that a person starts, not from workflow, where it can slow down or time out other workflow work.
Reverting a single Record
To restore one Record, an administrator does not need an Add-In. Open the Record, open the Admin Actions menu in the Record screen's footer (the Other Actions menu on a phone), and choose Revert Record Data. The panel lists the Record's recent saves, newest first, with who made each one and which fields it changed. Click a save under Revert to just before..., or enter a date and time in or before and click Preview, and the panel lists each field that would change with its Current Value, the value it will be restored to under Restore To, and the Action that will be taken. Clear the check box on any field you want to leave alone, then click the Revert button, which shows how many fields are checked, and confirm. Unlike the Add-In, Revert Record Data covers line item fields too, and it removes fields that were added after the chosen point. Fields it cannot safely restore, such as a field holding several values, are marked Not reverted with the reason. Fields stored on individual Documents are not included. The revert adds a note to the Record and is itself recorded in the Record's history, so it can be reverted in turn. The option appears only for administrators who can edit the Record.