[LASTVALUE] - Edellisen arvon hakeminen historiasta
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.
Syntaksi
The basic syntax is:
[LASTVALUE;AttributeName].
AttributeName: The name of the attribute as it appears in the object's history, written without brackets.
Käyttötapaukset
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;
[LASTVALUE;Department Number]
This retrieves the last recorded value for Osaston numero
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 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
ja VIITE
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:
[REFERENCE;DisplayName;UserId;1;[IFEMPTYUSE;[LASTVALUE;Manager];[manager]]]