Hello,
Is there any way how to set Component Lead for a specific project in a post function in a workflow ?
My idea or use case is, that I have to choose IT Technician, who is supposed to be on duty, so I would like him to be set as Component Lead in project "IT Support" (IS) for Components ABC and XYZ, and tickets are automatically assigned to Component Lead, so all issues are assigned to him. I do not want to set him manually to Component Lead role, I want to have it automatized (imagine adding different Technician to 10 Components every day). My idea is that I will create a ticket and set him as Assignee and in Post function for Create issue will be configured that Assignee will be set as Component Lead for specified Components, but I do not know how to do that. I'm able to use add-ons ScriptRunner and JWT.
Thank you very much for your help!
BR, JJ.
With Scriptrunner, what did you try?
I'd start from something that probably includes lines like
But obviously, I don't know how you are choosing the user to set or where you're getting the component from.
Hi Nic,
Thank you very much for your reply. Unfortunately I'm a total newbie in using ScriptRunner, so I do not know how to write a functional script :-(
My use case is:
So it is not about Components in the ticket, but about components in the Project and its Component Leads. Maybe this can be done other way, but I do not know how..
I do not know how to write the exact code, it should be like:
import com.atlassian.jira.component.ComponentAccessor
def projectManager = ComponentAccessor.getProjectManager()
def project = projectManager.getProjectObjByName("IT Support")
def components = project.getComponents().findByName("AD" OR "Cisco" OR "Other")
def newLead = getCurrentIssueAssignee()
components.setLead(newLead)
I do not know how to figure out the part getCurrentIssue Assignee and how to set Component Lead somehow like component.setLead() it just does not show me any option to set it. Also project.getComponents().findByName("AD" OR "Cisco" OR "Other") cannot have OR and multiple strings in brackets.
I hope it is understandable.
Thanks, JJ.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Assuming this is being done in a post function, then issue.getAssignee() will get you the assignee,
In your script, components is set to a list of components, not a single one, you will need to iterate over that list, setting each element's lead individually. Or do it one at a time, with three findbyname statement which should give you a single component directly. I've only every findbyname with single items.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jan,
with JWT it is unfortunately not possible to set the component lead via PostFunction.
I can already imagine that this can work with ScriptRunner, but I haven't found an example in a hurry.
A workaround with JWT could be that you use project properties.
You can set them via PostFunction and then set the assignee in the workflow equal to the responsible person from the project property.
If this should be an option for you, here is a link to our documentation:
Set or create JWT project property
Use project property in JWT expression
If you have any further questions, please feel free to create a ticket in our JWT Service Desk.
I hope this helps you further.
Cheers,
Frank
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Frank,
Thank you very much for your reply. I tried to do it using ScriptRunner, but I was not successful. So I hope that someone could advise :-)
Anyway thanks a lot for the idea with project property, I will try that ;-)
BR, Jan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jan,
if we can support you with the implementation with JWT, don't hesitate to create a ticket at our support.
That's what we are here for.
Have a nice weekend,
Frank
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.