The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Confluence groovy setEmail()

Lukas K.
Contributor
February 7, 2019

Hi,

I have problem with setting new email to user in Confluence by groovy.

Documentation says that class com.atlassian.user.User have method setEmail(String email), but Script Console in Confluence says the opposite - Confluence uses implementation class com.atlassian.confluence.user.ConfluenceUserImpl and this class has no method for set email.

 

This is my code:

import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.user.UserManager
import com.atlassian.user.User

def userManager = ComponentLocator.getComponent(UserManager)

User user = userManager.getUser("user001");
user.setEmail("new@email.cz");

 

Have you idea how can I set the new email by groovy (script runner) in Confluence?

 

Thanks

Lukas

 

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Anton Kulikov
April 15, 2021

maybe you should try this to get user

def users = userManager.users.find{it.getName() == "username"}

 

TAGS
AUG Leaders

Atlassian Community Events