I created the following code snippet to retrieve the current logged-in user's role information:
{% fetchxml userRoles %}
<fetch>
<entity name="role">
<attribute name="name" />
<link-entity name="systemuserroles" from="roleid" to="roleid" link-type="inner">
<filter>
<condition attribute="systemuserid" operator="eq" value="{{ user.id }}" />
</filter>
</link-entity>
</entity>
</fetch>
{% endfetchxml %}
{% if userRoles.results.size > 0 %}
<ul>
{% for role in userRoles.results %}
<li>{{ role.name }}</li>
{% endfor %}
</ul>
{% else %}
<p>No roles assigned.</p>
{% endif %}
However, when running the code above, it does not retrieve the roles of the current user.
Even though I have created Table Permissions for the Security Role table.
I wonder if anyone on the forum has encountered this issue like I have?
Thank you for reading my post.