Forum Discussion
Hi Tim, the context objects provide "shallow" information for a number of reasons including performance. They typically include the identifying data needed to make subsequent REST calls to get complete attributes for an object. In your example you would use the id or login available in the context object and then make a subsequent REST call to the user service: /users/id/${user.id}.
This will return a "deep" set of attributes including the first and last name of the user. Look for:
<profile name="name_first" type="string">FIRST NAME HERE</profile>
<profile name="name_last" type="string">LAST NAME HERE</profile>
The code will look something like this (i'm a rookie when it comes to freemarker so my guess is there's a more elegant way to do this but this works):
<#assign fullName=''/>
<#assign aUser=rest("/users/id/${user.id}").user/>
<#list aUser.profiles.profile as profileList>
<#if profileList.@name=='name_first'>
<#assign fullName=profileList/>
</#if>
<#if profileList.@name=='name_last'>
<#assign fullName=fullName + ' ' + profileList/>
</#if>
</#list>
Related Content
- 5 years ago
- 8 years ago
- 10 years ago