Free cookie consent management tool by TermsFeed loggedInUser() Function
loggedInUser() Function

Function

loggedInUser()

Returns the current user logged in to the application.

Parameters

No parameters.

Returns

User

Usage considerations

It is only applicable in situations where there is a user context, such as when rendering an interface, displaying a report, or executing a process task form.

If there is no user context, such as when used in an expression in a node output, loggedInUser() returns "Administrator".

In non-SAIL task forms that do not follow an activity-chained flow, loggedInUser() can be populated by selecting the Refresh default values every time the task form is viewed checkbox on the Other tab of the activity. The checkbox does not need to be selected when an interface is used as it is automatically applied.

The function can be used to filter process reports for the current user. Cast the data to the User data type with the touser() function.

loggedInUser() cannot be used to define a column of process report data or in a process event.

Examples

You can copy and paste these examples into the Expression Rule Designer to see how this works.

Return the user that is viewing a report or an interface:

loggedInUser() returns current.user

Identify if the logged in user is in an array of users using the contains() function:

contains(pv!userArray, touser(loggedinuser())) returns true or false

Identify if the user viewing a task is the task owner using the tp!owner task property:

loggedinuser()=touser(tp!owner) returns true or false

Note:  Cast tp!owner to the User data type with the touser() function so that there's no error when comparing with loggedinuser() as soon as a task is accepted. Not doing so results in the error message Cannot compare incompatible operands of type User and type User id.

Feature compatibility

The table below lists this function's compatibility with various features in Appian.
Feature Compatibility Note
Portals Partially compatible

Can be used with Appian Portals if it is connected using an integration and web API.

Offline Mobile Compatible
Sync-Time Custom Record Fields Incompatible
Real-Time Custom Record Fields Incompatible
Process Reports Compatible
Process Events Compatible
Open in Github Built: Tue, Apr 16, 2024 (02:44:18 PM)

loggedInUser() Function

FEEDBACK