UI Framework Object Structure accessible from Html form

I want to implement velocity or logic test in HTML Form like below

<excludeIf velocityTest="$patient.gender == 'F' "> Content stays here </excludeIf>

Now I want to do something like

<excludeIf velocityTest="$user.role == 'Admin' "> Content stays here </excludeIf>

How can I acheive this or where can I get the list or structure of the objects, I basically want to show and display form content based on user roles.

So for HFE, the gritty work of setting up the Velocity context is done here. Might not be the cleanest documentation, but at least it should show you what’s available. As you can see, the Velocity user variable refers to the actually authenticated User object, which has all the fields listed here.

To tell if a User has a particular role it’s best to use the User#hasRole() function as this handles certain logic like nested roles and the idea that the super has all roles. To do this from Velocity, you just need:

<excludeIf velocityTest="$user.hasRole('Admin')">
    <!-- content goes here -->
</excludeIf>
2 Likes

This is exactly what am asking for. I will read up the documents. Thanks.

i want to do the same with the "encounter creator " but encounter.creator doesn’t work

I’m going to guess that it’s something like: $session.encounter.creator.

1 Like

many many many thank you.

works perfect with this:

<includeIf velocityTest="$session.encounter.creator == 'username' ">