Returns an array of candidate snapshots that match the search criteria specified in query.
These snapshots could then be offered to the user and when a selection
is made, method #restoreSnapshot(String) can be called to implement the restore.
Javascript example 1. Find a snapshot with a specific id:
var query = new SnapshotQuery();
query.setSnapshotId("123456789-HHH-BBB");
var snapshots = system.snapshotManager.getSnapshots(query);
if(snapshots.length == 1)
{
//found a match, do something...
var snapshot = snapshots[0];
.....
}
Javascript example 2. Find snapshots for the current form and for current user which have not expired:
var query = new SnapshotQuery();
var snapshot_fields = {};
snapshot_fields.form_id = form.elementName;
snapshot_fields.username = system.securityManager.userName;
query.setFields(snapshot_fields);
var snapshots = system.snapshotManager.getSnapshots(query);
if(snapshots.length > 0)
{
//found matches, do something...
for each(var snapshot in snapshots)
{
//do something with snapshot
.......
}
}
query
. These snapshots could then be offered to the user and when a selection is made, method #restoreSnapshot(String) can be called to implement the restore.Further documentation.
Javascript example 1. Find a snapshot with a specific id:
Javascript example 2. Find snapshots for the current form and for current user which have not expired: