After the issue is created, during 'edit' issue if the custom field value is updated, I want the sub-tasks to be created. Is this possible?
I think you should create a listener that catches the event of editing the custom field value.
Kostas,
Do you have an idea on how to create a listener? I have tried using this but receiving erros:
com.atlassian.jira.event.issue.IssueEvent
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yeah for "edit" operations you will need a listener... can you be more specific about the error you are getting.
You could use a Script Listeners -> Create sub-task, then specify a condition which checks if the value of your field has been newly changed to the value you care about.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My custom field is a date field. When user chooses a date for this field (which will not be chosen while creating /transitioning a ticket, ), sub-tasks should be triggered. If I have to use Script listeners, What are the steps that I need to follow?
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have tried to create a normal listener from Administration > Listeners the follwoing way.
Name: Listener for issue event
Class: com.atlassian.jira.event.issue.IssueEvent
Error: Exception loading class: [com.atlassian.jira.event.issue.IssueEvent doesn't have any satisfiable constructors. Unsatisfiable dependencies: [[interface com.atlassian.jira.issue.Issue, interface java.util.Map, interface com.atlassian.crowd.embedded.api.User, class java.lang.Long], [interface com.atlassian.jira.issue.Issue, interface com.atlassian.crowd.embedded.api.User, interface com.atlassian.jira.issue.comments.Comment, interface com.atlassian.jira.issue.worklog.Worklog, class org.ofbiz.core.entity.GenericValue, interface java.util.Map, class java.lang.Long], [interface com.atlassian.jira.issue.Issue, interface com.atlassian.crowd.embedded.api.User, interface com.atlassian.jira.issue.comments.Comment, interface com.atlassian.jira.issue.worklog.Worklog, class org.ofbiz.core.entity.GenericValue, interface java.util.Map, class java.lang.Long, boolean], [interface com.atlassian.jira.issue.Issue, interface java.util.Map, interface com.atlassian.crowd.embedded.api.User, class java.lang.Long, boolean], [interface com.atlassian.jira.issue.Issue, interface com.atlassian.crowd.embedded.api.User, interface com.atlassian.jira.issue.comments.Comment, interface com.atlassian.jira.issue.worklog.Worklog, class org.ofbiz.core.entity.GenericValue, interface java.util.Map, class java.lang.Long, boolean, boolean]]].
Name: Listener for issue event
Class: com.atlassian.jira.event.issue.IssueEventListener
Error:
Exception loading class: [Bad Access: 'com.atlassian.jira.event.issue.IssueEventListener' is not instantiable].
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Vishali,
as Jamie said in the above comment you have to create a scripted listener using groovyrunner.
Script Listeneners > Create Sub-task
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Kostas,
As the custom field value will either have a date or null value, what should I set the condition to be?
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Vishali,
what's the type of custom field that you are editing and fires the issue creation?
If it's a date custom field, i think condition should be something like:
cfValues['date_field'] == null || cfValues['date_field'] != null
If it's not a date field i think there should be a regex that validates if the entered values have date like format.
Hope that helps
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Kostas,
Thank you for your reply. I was busy with one of the releases and couldn't respond faster. Could you please provide me detailed steps on how to do this?
Thanks and best regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey there,
Steps are the following:
After that you have to choose the event that your listener cathes and under witch conditions your listener will execute the desired action.
Check previous comments.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Kostas,
It worked for me. Thank you so much. Could you please tell me how do I assign each of the sub-task to a different assignee?
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Kostas,
The problem is - every time that I update anything in the ticket, sub-tasks are getting created. Is there a groovy script which I can run only when a date is chosen from the custom field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Vishali,
you should put a condition to the listener so it catches the event when condition is true.
e.g
cfValues['date_field'] == 'dd/mm/yyyy'
Add the condition when setting up the listener.
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Kostas,
Thank you for the valuable input. But when the license posting date is updated more than once, then sub-tasks are created more than once. What should I do in this scenario?
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Vishali,
in your existing condition add the following
&& issue.subTasks.size() <1
That way the listener will execute the action only when your issue doesn't have any subtask.
Test it first.
Hope that helps
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Based on the value selected in the position field, number of sub-tasks being created varies. After this, my listener works to create the extra sub-tasks. So it need not necessarily be <1. So, how should I handle this scenario?
Will a groovy script work in such scenario?
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmm,
i think in your case a custom listener is the solution. If i'm not wrong, the current built in listener cannot control the number of created subtasks when issue is updated, one subtask is created every time that conditions are met.
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Once you start talking about doing this on a transition, then Create on Transition Plugin for JIRA applies and you can create multiple subtasks, etc... See How to create multiple issues for instance or one of the other similar pages.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Would the above work with some tweaking were I had a value of 3 within a number field on then on transition say "approved" to have 3 sub-tasks created?
Thanks
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.