Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,366,257
Community Members
 
Community Events
168
Community Groups

Confluence groovy setEmail()

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

maybe you should try this to get user

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

 

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events