Hey Community,
I'm trying to use a post function to create a new issue during a workflow transition. Here's my set up:
First Task: ABC-1
During a transition of this First Task, a new issue gets created with a Linked Relationship "is blocked by." I'll call this one the Second Task, ABC-2.
When this Second Task is marked Done, I want a third issue to be created. I'll call this the Third Task, ABC-3. This Third Task should be created with a link to the First Task (as "blocks").
So ABC-1 is blocked by ABC-2. When ABC-2 is transitioned to Done, it creates ABC-3, which also blocks ABC-1. So ABC-1 cannot be done until these other two are finished.
The issue I'm having trouble with is getting ABC-3 to be created with a link to ABC-1. I ended up storing the Parent Link value (ABC-1) on ABC-2, so I had some way to track it.
I set up a Post Function for ABC-2, and here's what it looks like:
// Set the Issue Summary
issue.summary = "Review: ' + sourceIssue.summary
// Set the Assignee
issue.assigneeId = 'firstname.lastname'
issue.reporter = sourceIssue.assignee
// Set the Original Estimate of the New Ticket to 30 Minutes
issue.setOriginalEstimate(30*60)
// Grab the Parent Link of this Ticket
def ParentLink = customFieldManager.getCustomFieldObjects(sourceIssue).find {it.name == 'Parent Link'}
issue.setCustomFieldValue(ParentLink, sourceIssue.getCustomFieldValue(ParentLink))
// Use the Parent Link to Create a Link of this new issue to the original Parent
linkIssue(issue.id, ParentLink,"blocks")
I have an error on that last line with no help indicating the problem. Any advice?
Hi @Kmmaughs
I'm not sure how to do it via Post Functions - but it might be possible via Automation?
It looks like you need:
The last bullet might be best managed via a workflow condition - via automation it would be a status reversal, rather than stopping a user from making the transition.
If you would consider Automation - let me know if the rules above are correct and if there is any other information which might be beneficial - for example, is there a status that ABC-1 transitions to after ABC-3's creation which could be used to stop ABC-4 being created (as rule might just create a new issue each time a related issue is closed).
Ste
Hey Stephen,
I have JSU Automation installed; I hope this is what you were referring to: https://marketplace.atlassian.com/apps/5048/jsu-automation-suite-for-jira-workflows?hosting=server&tab=overview
Looking at your bulleted list, I have the first one working and done (with Automation). The second bullet is the one I'm struggling with. And the third one, I know how to do but am not currently enforcing the rule.
So it's really bullet two. How can I create that ABC-3 issue with a link to ABC-1?
Thanks in advance for taking a look at this.
-K
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kmmaughs
So this is how I built both rules (for reference).
Rule 1:
Rule 2:
----------------------
This is how its built:
----------------------
You can refine these rules of course - for example, if there is a condition for running Rule 1 (eg. a specific issue type).
Let us know if this is sufficient! If not and there is something you'd like to modify, let us know and I'll be happy to assist further :)
Ste
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmm....I don't have a three dots button anywhere.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For Rule 2, it's that last bullet - I cannot find a way to set the Linked Issue value from this Task 3 to Task 1.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kmmaughs
To be clear, I'm using Automation for Jira (native feature) - not JSU Automation Suite.
For example, to access project-level automation:
See more on Automation for Jira in the Knowledge Base.
Ste
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ahh, thank you for clarifying; this totally worked! I ended up storing the Parent Link as a custom field value (rather than using the Label field), so when I set up the Automation rule, the condition checks if the custom field is not empty.
For others reading through, the rule was set up in this manner:
And then when the issue was created, I copied and set various fields. One field I had to set was a Multi-Level Cascading Select value, which I struggled with a bit, but ultimately got it set by using this format in the Additional Fields section:
{
"fields": {
"customfield_11111" : [{ "id": "11111"}] }
}
Thanks so much, again!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kmmaughs
No worries - thanks for sharing your solution with the Community, this will help other users who locate this question!
I really like the way you utilised the "Parent Link" here, great option!
Ste
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.