How to copy parent ticket summary to sub-task summary (by script) ?

I have coded our current JIRA (5.2.6) to create two sub-task on specific workflow transition. Our business users have one request. They want that sub-task should have the same summary as parent ticket + a prefix. Example:

Parent ticket summary: "Good summary"
Sub-task summary: "[Text] Good summary"

So i tried to modify script:

issue.summary = "[Text]" + transientVars["issue"].summary 

but it did not worked.

Can anyone help me with that ?

3 answers

1 accepted

It's a bit ugly but this is the correct code:

issue.summary = "[Text] " + transientVars["originalissueobject"].summary

Hm, it seems that it does not work. When i set this script then sub-task is not created. If i specify issue.summary = "[Text]" then sub-task with [Text] summary is created.

I tested this and it did work - try putting your function last in the list of post-functions.

Jamie,

I have several questions. Lets start from begining. With your plugin i create a Sub-task listener. Listener configurations:

-------------------------------------------------------
ID 	Parameters
0 	Create a sub-task.
Subtask will be created with issue type: Descriptions Sub-task
Events: [Subtask Created]
Projects: [MOD]
Edit | Delete | Move down
-------------------------------------------------------
1 	Create a sub-task.
Subtask will be created with issue type: Photography Sub-task
Events: [Subtask Created]
Projects: [MOD]
Edit | Delete | Move up
------------------------------------------------------

Now these listeners are working and creates Sub-task on specifick transition and on "Custom Event".

But when i put issue.summary = "[Text]" then sub-task with [Text] summary is created.

in "Additional issue actions" then listeners do not work. Please see attached image:


Please addvise what i am doing wrong ?

Basically what i need? Example:

On specific transition or workflow in need to create two or more sub-task with summarry: [Description] Parent issue summary.

Looking forward to hearing from you.

Not really sure what you're trying to do. But when i put issue.summary = "[Text]" then sub-task with [Text] summary is created. is not valid code, I would assume you haven't actually put that, but it's in the screenshot as well.

If the code is invalid (additional script is compiled to code) there will be errors in the log file.

Sorry for the mistake. I am putting:

issue.summary = "[Text] " + transientVars["originalissueobject"].summary

but it seem that then listener do not work. I mean sub-task is not created.

can't find anything attached, can you paste to gist.github.com or pastebin.com

transientVars is only available in workflow functions, you should use "event.issue.summary".

I don't have skype, sorry. Use this:

issue.summary = "[Text] " + event.issue.summary

Now i used

issue.summary = "[Text] " + event.issue.summary["originalissueobject"]
and got an error
java.lang.RuntimeException: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: event for class: Script6
By the way maybe we can skype ? If yes my skype: eziookas

Jamie,

Maybe there is another way to contact you on-real time ?

I have another question about Grovvy Runner plugin.

Did that work? I'm sure you can understand why I do not do private support consultations for people, unless they are paying.

Jamie,

It did not worked and the same error is shown, I am confused. It is the only thing i need, in order to to finish task from boss. :(

P.S. now i understand you. There is nothing for free in this world :)

Jamie,

Maybe you could advice me how to add

issue.summary = "[Text] " + transientVars["originalissueobject"].summary
as a post-function in the workflow transition ?

Jamie,

I found when it works: issue.summary = '[Description] ' + issue.summary

But another small issue appears. If i executing one again the same transition (on which Script listener is working) additional subtask is created. Ho to avoid that ?

You need to use the "condition" to check for existing subtasks of the kind that you care about...

! issue.subtaskObjects.any{ it.issueType.name == "Sub-task"}

for example.

> P.S. now i understand you. There is nothing for free in this world :)

Are you kidding me!? You haven't paid for all the expert advice I've been giving you, nor for the plugin myself.

Sorry Jamie,

I did not want to offend your. I respect your advices.

No problem, no offence taken.

What is the context here... what plugin are you using, is this usinga built-in script function?

I am using Script Runner. I am creating a listener for a specific transition, on which execution JIRa will create two sub-tasks with specific summary. Summary consist of [Prafix]+"Parent ticket summary" Here is a screen shot what i want to do:

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in United States

Topic Tuesday: What's your favorite topic?

Good morning All, Our goal is to get you into the habit of while enjoying your favorite morning drink you are checking the NOVA "space" for topics and comments. Your input is really needed and...

57 views 4 0
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you