Hi experts,
We recently made workflow changes, stupidly, without backing up the previous workflow, this has broken our employee 'Offboarding' process when creating tickets, I'm hoping someone has some suggestions.
I'm having issues with the conditional execution of the Create issues and subtasks post function.
Our goal is to automatically create 6 linked issues with specific description. This functionality works fine, however, to prevent the double creation of linked issues if ticket flows through the same transition more than once, we have added the below condition.
%{Customer Request Type Name} = "Offboarding" and %{Number of linked issues} = 0
I have attached a photo of the post function and an example Offboarding ticket.
Hey I think this is the condition you are looking for. The condition will return true if the issue type is "Offboarding" and the issue has 0 inward links and 0 outward links.
import com.atlassian.jira.component.ComponentAccessor
def linkManager = ComponentAccessor.issueLinkManager
def hasInwardLinks = linkManager.getInwardLinks(issue.id).empty
def hasOutwardLinks = linkManager.getOutwardLinks(issue.id).empty
return issue.issueType.name == "Offboarding" && !hasInwardLinks && !hasOutwardLinks
Thanks Roland! Sorry for the delay it has been a busy couple of weeks!
I attempted your scripting condition within the conditional execution of the post function but an error was thrown, this could be due to syntax not being boolean?
With this assumption I tried adding the script to an actual condition in the transition, the syntax returned no errors but did not function as expected i.e. issue links were created when parent ticket contained linked issues.
Would I be correct in assuming you script is not compatible with boolean expression? Would you know a boolean script to acheive the same outcome or have any other suggestions?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you using JIRA cloud or JIRA server?
The error screenshot you sent is not familiar to me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately, if you are using JIRA Cloud, I wont be able to help you. JIRA Cloud is almost completely different from JIRA Server and ScriptRunner scripts are not interchangeable.
With that said the code I originally sent you had a logic error in it :P
hasInwardLinks and hasOutwardLinks would ent up true whenever the issue didnt have links and vice versa.
Here is a fix. You can try to implement something similar.
import com.atlassian.jira.component.ComponentAccessor
def linkManager = ComponentAccessor.issueLinkManager
def hasInwardLinks = !linkManager.getInwardLinks(issue.id).empty
def hasOutwardLinks = !linkManager.getOutwardLinks(issue.id).empty
return issue.issueType.name == "Offboarding" && !hasInwardLinks && !hasOutwardLinks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We are using Jira server and ScriptRunner, thanks for picking up the error I will retest shortly.
I still dont know where exactly I should be using this script?
1. In the conditional execution of the Create issues and subtasks post function.
2. A condition step within the transition
3. Custom script within a post function step
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried your modification in multiple condition options in the transition and still no dice.
It would help if I know exactly where within the transition this condition needs to be applied.
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.