Exactly like the title mentions... I am trying to query for when a child issue doesn't match certain parts of their parent from the 'Details' section of the issue.
I do have access to scriptrunner and am totally at a loss.
Any help would be very appreciated!
Please clarify, what field type are you using for the Details? Is it a Multi-Line text field?
And what type of comparison are you trying to make between the parent and child field? Is it for a particular word or multiple lines of text?
I am looking forward to your feedback and clarification.
Thank you and Kind regards,
Ram
Howdy Ram!
It is drop down field. I'm not sure if it comes standard for Jira, but as an example...
What I am trying to see is if the drop down field for the parent is set to 'Cat', I want to see all child issues where their drop down fields don't match their parent (i.e. set to 'Dog' instead).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So for your requirement, you can easily do a query using the ScriptRunner console.
Below is a sample working code for your reference:-
import com.adaptavist.hapi.jira.issues.Issues
def issue = Issues.getByKey('MOCK-1')
def parentListValue = issue.getCustomFieldValue('Sample List')
def differentOptions = [:]
issue.subTaskObjects.each { subTask ->
def subTaksListValue = subTask.getCustomFieldValue('Sample List')
if (subTaksListValue != parentListValue) {
differentOptions << ["${subTask.key}": "${subTask.getCustomFieldValue('Sample List')}"]
}
}
differentOptions
Please note that the sample working code above is not 100% exact to your environment. Hence, you must make the required modifications.
Below is a screenshot of the sample output:-
For this use case, I have created a sample Task Issue with a Couple of Sub-Tasks.
Below are the screenshots for your reference:-
1. For the Task Issue the value Option1 has been selected from the Sample List field as shown in the screenshot below:-
2. Below are the screenshots of the Sub-Tasks:-
In the screenshots above all the Sub-tasks except for Sub-taks MOCK-4 and MOCK-7 have the same value in the single select list as the parent issue.
Hence, only MOCK-4 and MOCK-7 are displayed in the result as expected.
I hope this helps to solve your question. :-)
I am looking forward to your feedback.
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Has your question been answered? If yes, please accept the answer.
Thank you and Kind regards,
Ram
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.