Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a post-function SubTask which inherits the name of the original Task

cns_jonathan January 21, 2019

Hi guys,

I have this workflow whereupon a transition, Issue A receives the subtask "Review". 

Currently, when it is transitioned it's just called "Review", but what I'd like to happen is that it would be called... "A: Review" so that it inherits the original task name. This would help me differentiate between each issue a little bit better.

I'm using ScriptRunner to do this.

So I guess, what would be the code for this? Where do I find out where the object's properties are?

My pseudocode would be something like this:

subtask.name = task.name + ": " + subtask.name

Is anyone able to help?

2 answers

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 22, 2019

How are you creating the sub-task? 

The reason I ask is that I suspect you are creating it in a post function on the transition, which is fine, but if your code is just saying issue.summary, then it's referring to the parent issue (and then not setting it because your code is all about the sub-task)

I say this is a guess, but it's exactly the mistake I made the first couple of times I tried to create sub-tasks in scripts, so I may be guessing the wrong thing!

cns_jonathan January 29, 2019

That's exactly what I'm doing. So how am I supposed to do it then?

0 votes
cns_jonathan January 21, 2019

So I tried this line of code in the "additional issue actions box":

issue.summary = '[' + sourceIssue.summary + ']' + 'Review'

 

Which I was hoping would make it look like:

[A] Review

 

But It doesn't work. It just creates the subtask with the subtask summary that was already set (Review).

Can anyone help me with this?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events