Hello,
I'm configuring a new postfunction with Scriptrunner to create subtasks. I need to check first if the issue has subtasks of the same type. I have added this condition
issue.subTaskObjects.any{ it.issueType.name == "Imputacion de Horas" }
I thought that checked if the issue has subtask of "Imputación de horas", but if the issue has another subtask doesn't generate the subtask.
Any ideas?
Thank you!!
Hi @Alejandra ,
please, just to be perfectly clear, how this should work...
You want to check, if there's at least one subtask with type "Imputacion de Horas"? No matter which types the other possible subtasks have?
Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Alejandra ,
this is really weird, I believe your code should work.
I've tested this code using console (with KEY = issue key and NAME = sub-task issue type name):
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue
IssueManager issueManager = ComponentAccessor.getIssueManager()
Issue issue = issueManager.getIssueObject("KEY")
issue.subTaskObjects.any{ it.issueType.name == "NAME" }
If issue with key KEY has at least one sub-task with type NAME, the last row returns true.
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.