Hello community! Im Ignacio, Jira Admin
To give the context a bit, it's the following:
In a project A *, we will store issues of the "Deployment" type, these issues will have a custom field where a version number related to a project B * will be entered at the time of finalizing the issue.
In project B we will find issues of the types:
Task x
Task y
Task z
Task i
Our client requires that, for example, when entering the version number related to project B in our project A, it validates that the issue types contained in the version of project B are "Task x, Task y and Task z ", then the system must allow ending the issue of project A. For example, if it were the case that the validation will find only issues of the type" Task z, Task i ", should not let the transition take place.
I couldn't find anything like it in the community forums, your help would be greatly appreciated.
We have Scriptrunner!
Actually I Have This
Hello Gustavo! Look at this is what I have at the moment. I'm getting the version id saved in the "" Project / Releases "field. As a test, the id is being saved as a comment within the problem, to validate that the postfunction is working correctly. What I am having trouble with is how to get? With that "version id" obtained, go to find the topics it contains and validate if there are the issuetype that I require in order to advance in the transition. Do you know if it is possible to pass a variable in a JQL or SQL query in jira? Thank you very much for your help!
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.util.UserUtil
import org.apache.log4j.Level
import org.apache.log4j.Logger
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.comments.CommentManager
def log = Logger.getLogger("com.acme.workflows")
log.setLevel(Level.DEBUG)
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Proyecto/Releases")
Issue issueKey = issue
// Get the current logged in user
def CurrentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()displayName
// Get access to the Jira comment and component manager
CommentManager commentManager = ComponentAccessor.getCommentManager()
ComponentManager componentManager = ComponentManager.getInstance()
def issueManager = ComponentAccessor.issueManager
// Get the last comment entered in on the issue to a String
def value = (String) issue.getCustomFieldValue(customField)
def comment = value
if(value !=null)
{
commentManager.create(issueKey, CurrentUser,comment, true)
}
log.info("the version selected is" + value)