Freesnapshot

This built-in method frees the Snapshot of an instance.

Syntax

MY_INSTANCE.freeSnapshot

Example

 # SORDER is a sales order instance. Its AMOUNT is 1000 initially# Enable snapshot on SORDERSORDER.snapshotEnabled=1# Change the customer code and the amountSORDER.CUSTOMER_CODE="JOHNDOE"SORDER.AMOUNT=3000# Check the credit limit# if ok, we free the snapshot otherwise we revert to the snapshot.OK=Fmet SORDER.CHECK_CREDIT_LIMIT : # This is a method of the C_SALESORDER classIf OK=1 : Credit limit okSORDER.freeSnapshot# SORDER not modified but its snapshot has been discardedElse : # Credit limit is not okSORDER.revertToSnapshot # SORDER reverted to its original stateEndif# If credit limit was ok, the snapshot has been freed and a new snapshot will be recreated when we modify # AMOUNT again.SORDER.AMOUNT=5000# If credit limit was ok, SORDER.AMOUNT is 5000 and SORDER.snapshot.AMOUNT is 3000# Otherwise SORDER.AMOUNT is also 5000 but SORDER.snapshot.AMOUNT is 1000

See also

revertToSnapshot, SnapshotEnabled, getmodified, snapshot, Sage X3 Script Glossary Snapshot