How to get the username of a user from a string that is the full name/display name of user in groovy script
You can try the UserSearchService
import com.atlassian.jira.component.ComponentAccessor
def users = ComponentAccessor.userSearchService.findUsersByFullName('Peter-Dave Sheehan')
if(users.size()>0){
return users.first()
}
Hello @PD Sheehan ,
Thanks, it worked.
I found the complete script:
import com.atlassian.jira.bc.user.search.UserSearchService import com.atlassian.jira.component.ComponentAccessor def userSearchService = ComponentAccessor.getComponent(UserSearchService) def users = userSearchService.findUsersByFullName("Mr Admin") if (users) { users.first() // an ApplicationUser (in jira 7) } else { // no users found with that display name }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline 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.