Skip to main content
Skip table of contents

[LASTVALUE] - Retrieving a Previous Value from History

The [LASTVALUE] function allows you to retrieve the most recent previous value of an attribute from the history of a user, group, or department. This function pulls 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 an old and new department name after a user is moved.


Syntax

The basic syntax is:

CODE
[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 get the previous value for an attribute, simply specify the attribute name. For example to get the previous department number for a primary position, simply write;

CODE
[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.

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

This expression first attempts to get the LASTVALUE. If that returns empty, it provides the currently registered DepartmentNumber as a fallback.

Advanced Combination: Find Previous Manager's Name

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

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

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.