I'm using better pdf exporter (Apache velocity) for printing out PDF's with information from issue cards. The code below has been working as intended before but after upgrading to datacenter and updating all the apps it stopped working and is now only printing "$name2. $name1". I already tried replacing jiraUserUtils and seeing if Atlassian removed functions so it doesnt return anything anymore. It's supposed to print the full name from customfield_14216 in form of "J. Doe".
I noticed that by commenting out #set ($name = $DisplayName) and #else it works by retrieving assignee name, but I need the name to come from the custom field.
##Handler name
#set($approversField = $customFieldManager.getCustomFieldObject('customfield_14216'))
#set($approversValue = $issue.getCustomFieldValue($approversField))
#set($UserNameString = $approversValue.toString())
#set ($index3 = $UserNameString.indexOf('('))
#set ($UserNameBefore = $UserNameString.substring(0,$index3))
#set($AppliUser = $jiraUserUtils.getUserName($UserNameBefore) )
#set($DisplayName = $AppliUser.getDisplayName() )
#if ( $approversValue )
#set ($name = $DisplayName)
#else
#set ($name = ${issue.getAssignee().getDisplayName()})
#end
#set ($index = $name.indexOf(' '))
#set ($index2 = $index+2)
#set ($name1 = $name.substring(0,$index))
#set ($name2 = $name.substring($index,$index2))
Thank you in advance
Resolved.
Replaced
#set($AppliUser = $jiraUserUtils.getUserName($UserNameBefore) )
with
#set($AppliUser = $userutils.getUserManager().getUserByName($UserNameBefore) )
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.