Hi,
using JIRA 6.3.13 and Scriptrunner 3.1.4 I'd like to add a simple scripted validator doing the following:
If there are incoming links of linktype "Teilprojekt" the linked issue(s) must NOT be "Open" for carrying out the transition. Link discription for incoming link is "is Teilprojekt of".
Very important: the validator should only check incomming, but not outgoing links.
Thank you!
Hello,
I think that something like this will work for you:
import com.atlassian.jira.component.ComponentAccessor
def issueLinkManager = ComponentAccessor.issueLinkManager
def inwardLinks = issueLinkManager.getInwardLinks(issue.id)
inwardLinks.each {
if (it.issueLinkType.name == "Teilprojekt") {
if ((it.sourceObject.status as String) == 'Open') {
return false
}
}
else return true
}
I did not test out the code directly, but I believe it should work. If something isn't working out please do not hestitate to come back and ask. :)
Regards,
Jenna
Hi Jenna,
thank you very much for looking into this one. But I am sorry. It is not working. The transition is not blocked.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry for my belated reply!
Were you able to get this to work? If not, do you see any errors?
Regards, Jenna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Jenna Davis, I am trying to do something similar but instead of Validator, I'm using post function.
The use case is - Whenever I clone an issue, I would like the new ticket to not have the old ticket's Due date field. I used the code below. The code runs without any errors but the Due Date value is still not cleared. Would you tell what I'm doing wrong?
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.fields.IssueLinksSystemField
import webwork.action.ActionContext
import java.sql.Timestamp
def fieldManager = ComponentAccessor.getFieldManager()
def issueLinkManager = ComponentAccessor.issueLinkManager
def inwardLinks = issueLinkManager.getInwardLinks(issue.id)
inwardLinks.each {
if (it.issueLinkType.name == "is cloned by") {
issue.setDueDate(null)
}
}
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.