Similar to this question, but I'm running into an error where the auto creating subtask will only create the last option in the checkbox list, and not all options selected after an edit.
Example:
Checkbox field at the parent issue after 1 edit:
Expected Results, subtask's summary as:
Actual Results:
In the listener script, I set Event trigger to Issue Created and Issue Updated. Under Conditions I use:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.customfields.option.Option
def cf = customFieldManager.getCustomFieldObjectsByName("Checkbox")
def cfValue = cf.getAt(0).getValue(issue)
def subtaskSummaries = (cf as Collection<Option>)*.value
if(issue.issueType.name == "Parent" && cfValue != null){
if(!issue.getSubTaskObjects()*.summary.equals(subtaskSummaries)){
return true
}
}
def cf = customFieldManager.getCustomFieldObjectsByName("Checkbox").getAt(0)
def cfValue = sourceIssue.getCustomFieldValue(cf)
def subtaskSummaries = (cf as Collection<Option>)*.value
subtaskSummaries.each {
if(!sourceIssue.getSubTaskObjects()*.summary.contains(it)){
issue.summary = "Subtask: " + it
}
}
Hello Jon,
For your use case, I think that sub-tasks would be a good feature since you can add them as shipments while tasks are the Contract Request itself.
Also, I believe that the import using CSV (Excel) can be useful to create the sub-tasks once many fields are with the same value:
thanks for this idea. is there a way to when making the issue (in this case its a contract) to make a certain number of sub tasks? for example, I would make a contract, and want to make 50 sub tasks. the fields in these subtasks would be supplied at that time or at a later date but the main thing is that the subtasks are created at that time indicating that there are 50 loads (or sub tasks) on this contract for us to pick up.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Jon,
I would recommend you to use the CSV import option provided before if you are looking for a free option, however, if you are looking for a more practical option, there are a lot of plugins that you can use to achieve that goal.
The one I recommend you is the Automation Lite for JIRA Cloud, where you can create a simple rule to automatically create sub-tasks when creating a new issue:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks for this idea. is there a way to automate the number of sub tasks it makes? and have the number of sub tasks created contingent on a custom field in the issue (i.e. "Number of loads")?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi petterson,
just wanted to check if this idea that you gave can incorporate a function on how many sub tasks to create based on a field in the parent issue " Number of Loads" which can be anywhere from 1-100?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Jon,
Unfortunately, I think it's not possible to create multiple sub-tasks based on a Custom field number using Automation for JIRA.
I think the only possible way to do it using Automation for JIRA is by configuring a single action for each sub-task created.
Also, if you are familiar to Groovy Script, you can use the Add-on Scriptrunner and follow the instructions on the question below to configure your script:
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.