Available Roles Filter Expressions Not Loading Roles
This document explains why AvailableRoles expressions may not return any roles in Activate version 8, and how to configure the expression correctly.
Overview
In Activate version 8, AvailableRoles expressions are evaluated differently depending on whether the expression is resolved before being passed to the role selector. If configured incorrectly, the role picker may load no roles at all.
Cause
When an AvailableRoles expression is defined without explicitly passing it through as an expression, Activate evaluates it immediately and passes the resolved collection into the role selector. This prevents the SelectRole control from applying the expression logic as intended, resulting in an empty role list.
Resolution
Prefix the AvailableRoles value with an @ symbol. This ensures the expression itself is passed to the SelectRole control, rather than the resolved results.
Behaviour Considerations
When using this approach, be aware of the following behaviour:
- The expression returns all roles that have the specified parameter set
- Child roles are also returned, regardless of whether the parameter is set on the child
- This can result in duplicate or unexpected role entries when using hierarchical role structures
Because of this behaviour, this approach is only suitable when roles are organised in a flat structure.
Alternative for Nested Roles
If a nested role structure is required, use the Filter property on the SelectRole control instead of AvailableRoles.
Support for filtering nested role structures was improved in Activate version 8.2, and later versions handle this scenario more reliably.
Summary
To ensure AvailableRoles expressions load correctly in Activate version 8:
- Prefix the AvailableRoles expression with @
- Use a flat role structure to avoid duplicates
- Use the SelectRole Filter property for nested roles in version 8.2 and later