Forums

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

Is it possible to tie component to an assignee?

folashade okeyinka June 20, 2019

I am trying to connect components to assignee such that when I assign an issue to someone the component will be auto-assigned. The system is built such that each person belongs to a group which translates into component in the front end.

4 answers

1 vote
Ilya Turov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 20, 2019

I feel like even script won't be much help here, since ProjectComponentManager.update() throws an error and it seems like a known bug. So I guess even plugin with such functionality might not exist since as far as I understand it would still use atlassians java api.

folashade okeyinka June 20, 2019

I guess I will stick to the reverse that we currently have. Thank you for your response.

1 vote
Joe Pitt
Community Champion
June 20, 2019

I'm not sure if @Tomas Gustavsson answer is what you're looking for. With the component lead you assign the component and the component lead is automatically assigned.  It sounds like you want to assign an issue to someone and have the component assigned. Do you want that behaviour to carry forward for each time an issue is reassigned? If so you can't do it without a script or plugin. 

folashade okeyinka June 20, 2019

@Joe Pitt this is exactly what I want. I am fine if it does not carry forward for now. Do you know how I can work around it?

Joe Pitt
Community Champion
June 20, 2019

You would need a script (I don't do those) or a plugin. The problem you're going to have is maintaining it. Everytime the users change you'll need to update the code. 

Like folashade okeyinka likes this
1 vote
Tomas Gustavsson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 20, 2019

Yes that should be possible, with setting a component lead image.png

folashade okeyinka June 20, 2019

Thank you @Tomas Gustavsson for your response but I want the reverse of the process you described.

0 votes
Ilya Turov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 20, 2019

alright, it's kinda feels dumb now, but I got it working:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.bc.project.component.MutableProjectComponent

def issueComponents = issue.components
if (!issueComponents || !issue.assignee) {return}
def component = ComponentAccessor.projectComponentManager.find(issueComponents[0].id)
def mutableComponent = MutableProjectComponent.copy(component)
mutableComponent.setLead(issue.assignee.name)
ComponentAccessor.projectComponentManager.update(mutableComponent)

so if you have a scriptrunner and insert it into a postfunction on some transition or listener and listen to issueAssigned event it should work, tho some tuning definitely might be one, thats just a raw core

Suggest an answer

Log in or Sign up to answer