Attention all Jira reporting gurus!
One of the areas of our organisation is utilising Jira to manage our Enterprise Initiatives/Projects through a highly structured web of Initiative Tasks/Sub-tasks.
We are currently pulling information out of Jira into PowerBI in order to build reporting on these pieces of work, but after issues with PowerBI and a lack of expert-level knowledge in data transformation in that tool, we're hoping to try and get the required reporting working within Jira or Confluence itself. Might not be possible, but worth an ask!
Here's what I'm hoping might be possible:
🥇 Dream goal: Create a dropdown of the Initiative Issues that can self-populate from a filter of all open initiatives.
🎖️ Dream Usage: Utilise this drop down to filter information down to that relating to the Initiative Issue selected.
If it isn't possible to have the dropdown self-populate from a filter, this is a high enough priority area that we would be willing to manually modify if necessary (These are multi-year Initiatives which don't change often).
Custom Charts does allow users to create Filter buttons (in a similar manner to board Quick filters), but the dropdown would be my ultimate goal.
Tools/Add-ons we have access to utilise at current:
Jira
Confluence
Custom Charts Add-On
Hey there @Sam!
Mark's answer is essentially correct, but could fail depending on the type of field that you're working with. Some fields can just be set with a String, but others need a list of Option objects and other sorts of things.
What sort of field are wanting to copy over? For instance, is it a regular system field (one of the built-ins), or a custom field? If it's a system field, which? And if it's a custom field, what type? This information will help in getting you the most accurate solution possible.
Thanks! :D
Aidan
@Aidan Derossett [Adaptavist]. you are correct. I am trying to set the value based on a "Version Picker (multiple version)" and I am having troubles to work with it. Is there any tutorial to help me?
I basically need to copy the value of a custom field (Version Picker (multiple version)) from my parent issue to it's subtasks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Aidan Derossett [Adaptavist]
I'm looking for same script for Assignee system field need to update when i update in parent to subtask. Please help me out with below script.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.MutableIssue
def change = event?.getChangeLog()?.getRelated("ChildChangeItem")?.find {it.field == "Assignee"}
if (change) {
log.debug "Value changed from ${change.oldstring} to ${change.newstring}"
// your actions if the field has changed
def subtasks = event.issue.getSubTaskObjects()
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Assignee")
if (subtasks){
subtasks.each {it ->
((MutableIssue) it).setCustomFieldValue(customField, change.newstring)
ComponentAccessor.getIssueManager().updateIssue(event.user, ((MutableIssue) it), EventDispatchOption.DO_NOT_DISPATCH, false)
}
}
Thanks,
Sai
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Sam
You can create Script listener, that will be triggers when your X field changes and update subtasks issues if they exist.
To create listener go Add-ons -> Script Listener ->Add -> Custom listener
Choose project you need, event Issue Updated (that means that listener will be triggered every time issues in you project updates)
And add script, for example:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.MutableIssue
def change = event?.getChangeLog()?.getRelated("ChildChangeItem")?.find {it.field == "your X field name"}
if (change) {
log.debug "Value changed from ${change.oldstring} to ${change.newstring}"
// your actions if the field has changed
def subtasks = event.issue.getSubTaskObjects()
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("your X field name")
if (subtasks){
subtasks.each {it ->
((MutableIssue) it).setCustomFieldValue(customField, change.newstring)
ComponentAccessor.getIssueManager().updateIssue(event.user, ((MutableIssue) it), EventDispatchOption.DO_NOT_DISPATCH, false)
}
}
}
do not forget to correct code with your fieldnames.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mark, I'm also trying to achieve this technique. However, instead of a string, the fields I am trying to update are custom field Radio Buttons. Here is the code I have so far, which is not working:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.MutableIssue
def change = event?.getChangeLog()?.getRelated("ChildChangeItem")?.find {it.field == "Claim Approved"}
if (change) {
log.debug "Value changed from ${change.oldstring} to ${change.newstring}"
// your actions if the field has changed
def subtasks = event.issue.getSubTaskObjects()
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Claim Approved")
if (subtasks){
subtasks.each {it ->
((MutableIssue) it).setCustomFieldValue(customField, change.newstring)
ComponentAccessor.getIssueManager().updateIssue(event.user, ((MutableIssue) it), EventDispatchOption.DO_NOT_DISPATCH, false)
}
}
}
How would I modify this for a Radio Button?
And if you have time, how would you modify this for a select list with various options? (This one isn't critical for me at the moment, but I'm sure I'll need it down the road)
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Gavin Minnis
If you want to update selectlists, radio buttons, checkboxes fields you need to pass Option object, not string.
Here is example.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.MutableIssue
def change = event?.getChangeLog()?.getRelated("ChildChangeItem")?.find {it.field == "Claim Approved"}
if (change) {
log.debug "Value changed from ${change.oldstring} to ${change.newstring}"
// your actions if the field has changed
def subtasks = event.issue.getSubTaskObjects()
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Claim Approved")
if (subtasks){
subtasks.each {it ->
def options = ComponentAccessor.getOptionsManager().getOptions(customField.getRelevantConfig(it))
((MutableIssue) it).setCustomFieldValue(customField, options.find {it.value == change.newstring})
ComponentAccessor.getIssueManager().updateIssue(event.user, ((MutableIssue) it), EventDispatchOption.DO_NOT_DISPATCH, false)
}
}
}
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.
You re welcome! :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Mark Markov, and if its a Version Picker (multiple version) custom field? Is it possible to update the sub-tasks if a specific field from the parent issue is changed?
My situation is:
1 - Parent issue have a "x" custom field (Version Picker (multiple version))
2 - If that "x" custom field is changed I want to update the same field on it's sub-tasks.
Thanks in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My field is a Select List - Single Choice. I have added your code but it is throwing a null value for my listener?
Any advice would be greatly appreciated!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Mark Markov For some reason I can't get this script to work. I want to Fix Version/s -field to be updated and Script Listener shows "No failures in the last 4 execution(s)" but field in subtask is still out dated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thank you for your answers. I've just started playing around with this script.
I would like to update: Custom fields - string, Description field - string, Dates fields.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Sam @Mark Markov < how do i update summary value in subtasks based on parent issue custom field automatically.
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.