I am trying to automatically assign a issue to a particular developer based on the custom field value.
In my case the custom field is "Product Name" a drop down single selection list.
So based on 'A', 'B' or 'C' , I have to assign the ticket to different developer.
I am not able to find any option of adding an event listener class in the "create" transition of the workflow.
Even using post-function in "create" transition of workflow, I am not able to find any proper way to achieve this.
Can anyone please help me with this ?
Event listeners are not part of a workflow, so you don't see a way to add them.
What you need here is either a post-function OR a listener. You can use a post-function if you want to do this as part of the workflow (assigning things on issue create, or issue moves into "dev" status or is closed), but if you want to be able to catch any update and change the assignee, you do need a listener. The most common reason is "I want to change assignee when field X is changed" - post-functions don't catch field updates as they only get run when the status is changed.
Once you've decided where it's appropriate to run your code, you'll need a way to get it into JIRA. I'd use the Script Runner for this (unless you can find a pre-written add-on which can provide it). A post-function or listener to set the assignee based on a field are quite easy to do with Script Runner.
For example, the setting of an assignee on create is not much more than
and then use this to get the customfield value to base your logic on:
issue.getCustomFieldValue (customFieldManager.getCustomFieldObjectByName("Product Name"))
I never made a script in JIRA so I do not know the API.
I need to do almost exactly what you say :
assign issue to member of project role defined in a custom field. Do it from a com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.CustomScriptFunction
Can you point to the good function ?
And if imports are necessary please also tell, it's real hard the first time to get where the information is.
Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs