Revert
Description
Discards any changes made to the Entity object.
Use this method to exit the transaction that allowed the record to be edited. You should call this method if you tried to change a record and the Validate method returned an error string.
You can call this method
only if the Entity object is editable. To make an existing Entity object editable,
call the EditEntity
method
of the Session object. If you call this method on a newly created Entity object,
one that was created with the BuildEntity method, this method cancels the
submission of the record.
This method reverts the Entity's fields to the values that were stored in the database. After reverting, the Entity is no longer editable, so you must call the EditEntity method again to make new modifications.
Syntax
VBScript
entity.Revert
Perl
$entity->Revert
();
- Identifier
- Description
- entity
- An Entity object representing a user data record. Inside a hook, if you omit this part of the syntax, the Entity object corresponding to the current data record is assumed (VBScript only).
- Return value
- None.
Examples
VBScript
Dim entityToEdit
set sessionObj = GetSession
set entityToEdit = sessionObj.GetEntity ("Defect", "SAMPL00000002")
sessionObj.EditEntity entityToEdit, "modify"
' ...make modifications to the entity object
' Revert the changes to the record
entityToEdit.Revert
Perl
# Get the current session
$sessionobj = $entity->GetSession();
# Select an entity to modify
$entityobj = $session->GetEntity("defect","BUGID00000042");
# Take the modify action on the entity object
$sessionobj->EditEntity($entityobj,"modify");
# ...make modifications to the entity object
# Revert the changes
$entityobj->Revert();
# At this point, the entity object is no longer modifiable