Hello everybody,
i try to set the project lead a project with Groovy/Scriptrunner.
I have already seen and tested post Set Project Lead with Script Runner .
I have the problem that the username is set in the project, but when I check the result via GUI the message
"Looks like we can't find the selected project lead.
They may have been deleted from your instance. Click 'Edit defaults' to select a new project lead."
is displayed and the user is not showed recognized as JIRA user.
On edit screen, the right JIRA user is displayed. If I close the screen with "update" the user is now correct.
Is there are final command to complet to set the project lead?
import com.atlassian.jira.project.Project
import com.atlassian.jira.project.ProjectManager
import com.atlassian.jira.project.AssigneeTypes
import com.atlassian.jira.component.ComponentAccessor
def originalproject = ComponentAccessor.getProjectManager().getProjectObjByKey("APP1")
def name = "AAA"
def description = "test"
def String leadkey = "jira_admin" // this is username in my JIRA instance
def url = ""
ComponentAccessor.getProjectManager().updateProject(originalproject,name,description,leadkey,url,AssigneeTypes.UNASSIGNED)
Hi Tom,
Seems like you are trying to define username to the leadkey variable, but you should define User Key.
try adding the next two lines to your code:
import com.atlassian.jira.user.ApplicationUser
def String leadkey = ComponentAccessor.userManager.getUserByName("jira_admin").key
it should help
Thank you for your answer, but I have allready fix it with this solution:
I forgott this threat :(
Is maybe not the smart solution, but is works.
// BenutzerListe aufbauen
Collection<String> BenutzerCollection = new ArrayList<>();
for(item in issue.getCustomFieldValue(destProjectAdmins) ) {
def tmp = (ApplicationUser)item
BenutzerCollection.add( tmp.getKey() );
}
// BenutzerListe als PAdmin setzen
projectRoleService.addActorsToProjectRole(BenutzerCollection,
projectRole,
ProjektPM,
ProjectRoleActor.USER_ROLE_ACTOR_TYPE,
errorCollection)
// test
if ( errorCollection.hasAnyErrors() ){
log.warn("Error")
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tom,
I haven't had time to test this, but I can see you added "String" into the line:
def String leadkey = "jira_admin"
This seems different from the original code provided by Alexey.
Can you try taking String out so you're not defining the object to be a String value?
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.