Hi All,
I am using the following Groovy script to extract last modified by username. However when I select Text field as the Template I get the username but when I select User Picker Template I get Anonymous. I need the full name to displayed and not just the username.
changeItems = componentManager.changeHistoryManager.getAllChangeItems(issue) if (changeItems?.size()> 0 ) { componentManager.userUtil.getUserObject(changeItems.sort( false ).last().user) } else { null } |
Hi,
Can you try the following code?
import com.atlassian.jira.component.ComponentAccessor def changeHistoryManager = ComponentAccessor.getChangeHistoryManager() def changeItems = changeHistoryManager.getAllChangeItems(issue) if (changeItems?.size() > 0) { def userUtil = ComponentAccessor.getUserUtil() def userkey = changeItems.sort(false).last().getUserKey() userUtil.getUserByKey(userkey) } else { null }
The User Picker template expects com.atlassian.jira.user.ApplicationUser instead of a com.atlassian.crowd.embedded.api.User.
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.
I just edited my answer. The code was returning the user name while it should have returned the ApplicationUser instead.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bear also in mind that if the field uses the User Picker template, it will appear on the right hand side of the issue screen, under the People section.
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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.