In some cases, you may need a message template to specify which department an access right is associated with. This is particularly useful when an employee holds multiple positions in different departments and is granted department-specific permissions, for example, in a patient record system.
This guide provides a compound expression that returns both the name of the access right and the department it is associated with.
The Expression
You can use the following expression in a message template or test it in the Expression Builder.
[OBJECTPERMISSION.SYSTEMROLE;Name;Id;1634] - [PRETTIFY;[REFERENCE;Department;Id;2;[OBJECTPERMISSION;ManagerOf;RoleTypeId;1634]]]
Warning: This is an example. You must replace the number 1634 with the actual ID of the system role you want to reference.
How It Works
The expression consists of two parts separated by a hyphen:
-
Access Right Name:
[OBJECTPERMISSION.SYSTEMROLE;Name;Id;1634]-
This part of the expression retrieves the name of the system role with the specified ID.
-
-
Department Name:
[PRETTIFY;[REFERENCE;Department;Id;2;[OBJECTPERMISSION:ManagerOf:RoleTypeId:1634]]]-
This section looks up and returns the name of the department to which the access right is linked.
-
Sample Output
When used in the Expression Builder or a message flow, the expression will produce a result in a format similar to the following: "Access Right Name - Department Name".