SnapshotManager.createSnapshot

Creates a snapshot for the application currently being executed. The snapshot can then be used in a subsequent restore operation (#restoreSnapshot(String)). All state data for the application is saved. Snapshot fields are key value pairs and are used to give additional information to the snapshot. These can be used for many different purposes:
  • Password authentication
  • Security questions
  • Form or application identifier
  • Page identifier
  • User identifier
  • etc....

Further documentation.

Javascript example 1. Add form id, user name and password authentication to the Snapshot:

 var snapshot_fields = {};
 snapshot_fields.form_id = form.elementName;
 snapshot_fields.username = system.securityManager.userName;
 snapshot_fields.password = EncryptionServices.encrypt("myPassword");
 var snapshot = system.snapshotManager.createSnapshot(snapshot_fields, null);
 
Javascript example 2. Add security questions to the Snapshot and an expiry date:
 var snapshot_fields = {};
 snapshot_fields.color = fields.COLOR.displayValue;
 snapshot_fields.pet = fields.PET.displayValue;
 snapshot_fields.maiden_name = fields.MAIDEN_NAME.displayValue;
 var expiry = new Date();
 expiry.setDate(expiry.getDate() + 30);
 var snapshot = system.snapshotManager.createSnapshot(snapshot_fields, expiry);
 

returns java.lang.String

Parameters

java.util.Map  snapshotFields,  java.util.Date  expiryDate,