GetFieldOriginalValue

Description

Returns a FieldInfo object containing the value that the specified field will revert to, if the action is cancelled.

When you initiate an action, HCL Compass caches the original values of the record's fields in case the action is cancelled. You can use this method to return the original value of a field that you have modified. You can get the original value of a field only while the record is editable. The record's notification hook is the last opportunity to get the original value before a new value takes effect.

Syntax

VBScript


entity.GetFieldOriginalValue (field_name) 

Perl


$entity->GetFieldOriginalValue(field_name); 
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).
field_name
A String containing a valid field name of this Entity object.
Return value
A FieldInfo object that contains the original value for the specified field.

Example

VBScript


' Iterate through the fields and report which ones have changed.
fieldNameList = GetFieldNames
For Each fieldName in fieldNameList
   originalValue = GetFieldOriginalValue(fieldName).GetValue
   currentValue = GetFieldValue(fieldName).GetValue
   If currentValue <> originalValue Then
      ' Report a change in the field value
      OutputDebugString "The value in field " & fieldName & " has changed."

   End If 
Next 

Perl

my($FieldNamesRef) = $entity->GetFieldNames();

   foreach $FN (@$FieldNamesRef) {

      # Get the field's original value...

      $FieldInfo = $entity->GetFieldOriginalValue($FN);

      #...
   }