eADM

[LASTVALUE] - Retrieving a Previous Value from History

The [LASTVALUE] This function allows you to retrieve the most recent previous value of an attribute from the history of a user, group, or department. This function retrieves the previous value directly from the object's history log, not from its currently registered attributes.

This is useful for creating notifications or reports that show what has changed, such as displaying both the old and new department names after a user is moved.



Syntax

The basic syntax is:

[LASTVALUE;AttributeName].
  • AttributeName: The name of the attribute as it appears in the object's history, written without brackets.



Use Cases

Basic Value Retrieval

To retrieve the previous value for an attribute, simply specify the attribute name. For example, to retrieve the previous department number for a primary position, simply write:

[LASTVALUE;Department Number]

This retrieves the last recorded value for Department Number from the object's history.


Fallback to Current Value if History is Empty

You can use the [IFEMPTYUSE] function to display the current value of an attribute if no previous value exists in the history.

[IFEMPTYUSE;[LASTVALUE;Department Number];[DepartmentNumber]]

This expression first attempts to retrieve the LOAD VALUE. If that returns an empty set, it returns the currently registered Department Number as a fallback.


Advanced Search: Find Previous Manager's Name

You can combine LOAD VALUE, IFEMPTYUSE, and REFERENCE to perform more complex lookups, such as finding the name of a previous manager. To retrieve the previous manager's name, or the current manager's name as a fallback, enter:

[REFERENCE;DisplayName;UserId;1;[IFEMPTYUSE;[LASTVALUE;Manager];[manager]]]