You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hello,
trying to find what parameters are available in user macros as below.
As in I just want the users firstname to show but cannot seem to get the syntax correct.
$action.remoteUser.name (works)
$action.remoteUser.FullName (works)
$action.remoteUser.FirstName (nothing)
$action.remoteUser.LastName (nothing)
is there any documentation showing this data?
thanks
Here are some of the functions available to the Confluence User object:
Unfortunately, there's nothing available to pull the first name, as Confluence doesn't keep track of which part of the full name is a first name, middle name, or last name. However, you could assume that it is the first word of the full name string in most cases. Therefore you could use something like this:
#set ( $fullName = $action.remoteUser.fullName )
#for ( $word in $fullName.split(" ") )
#set ( $firstName = $word )
#break
#end
<p>$firstName</p>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use #foreach, not #for (source: https://stackoverflow.com/questions/5683690/how-to-use-for-loop-in-velocity-template)
Since I'm using the user macro inline, I've skipped the <p> </p> bit.
This code works for me:
#set ( $fullName = $action.remoteUser.fullName )
#foreach ( $word in $fullName.split(" ") )
#set ( $firstName = $word )
#break
#end
$firstName
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Stephen Deutsch
Ware are on the way to update Confluence from 7.13.x to 7.19.x and I have found out that the the following code does not work in 7.19.x
$action.remoteUser.FullName
Not work mean, that exact this string is shown in the page instead of the fullname of the user.
Do you have an idea if there was a change in the code?
I have several macros with the $action-function which do not work anymore.
Thanks for your assistance.
Roman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh, after a several more searches I've found the following bug.
This is my workaround!
Most of my macroes work again and now I have to enhance the property with my needs.
Sorry for disturbing.
Regards, Roman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.