Copy linked issues to a custom field (as a string)

On specific transition, I would like to copy all issue links of specific type to a custom field (copy summary + key of linked issues into custom field).

It would be used for user to acknowledge/accept current state issue links (in this case it's for "inventory" project - user would acknowledge all SW installed in his PC, which is done by connecting issue for his HW with issues for SW licenses)

Would this possible via ScripRunner?

Thank you smile

1 answer

1 accepted

Hi Nikola,

It can be done very easily using "Read fields from linked issues or subtask" post-function provided by JIRA Workflow Toolbox.

You should use a configuration similar to this one:

conf-1.png

conf-2.png

conf-3.png

Configuration shown copies the fields Summary and Issue key of all Bug, New Feature and Task issues linked to current one with "is blocked by", "is cloned by" or "is duplicated by" issue link types into current issue's "Long Text" custom field.

Pairs SummaryIssue key are separated by comma character. An example of the value obtained at "Long Text" custom field might be:

Printer not working - CRM-34, Feature for uploading files - CRM-23, Compatibility with IE11 - CRM-54

Please, let me know whether this meets your requirements or not. I'm pretty sure I can implement your requirements using JIRA Workflow Toolbox.

Regards,

Fidel

Tried it, it works.

Sir, I think you have a new customer (if I'll get budget approval for it) smile  I was looking at Workflow Toolbox for a long time and this was the final weights on the scale.

Just one quick question - is it possible to put between the values in result line breaks instead of commas? It would be better arranged this way.

Thanks Nikola. I wish you become a user of JIRA Workflow Toolbox. I'm sure you will find many uses for it in your workflows.

I explain you how to replace comma separator with a new line character:

1) Select Ephemeral string 1 in parameter target field of  "Read fields from linked issues or subtask" post-function, instead of Long Text custom field.

2) Insert "Copy a parsed text to a field" post-function after "Read fields from linked issues or subtask" post-function with the following configuration:

  • Target field: Long Text
  • Parsing mode: advanced
  • Text to be parsed: 
replaceAll(%{00061}, ",(?=(\\s.+\\s-\\s[A-Z]+-[0-9]+(,|$)))", "\\n")

 

Explanation:

What we have done is to store temporarily the initial value obtained from "Read fields from linked issues or subtask" post-function into auxiliary field "Ephemeral string 1", and then we store its content in the definitive custom field (in the example "Long Text" custom field), after having replaced the commas after issue keys with line breaks (i.e., \n characters). to do it we use function replaceAll().

We use a complex regular expression instead of simply a comma character (,), because we might have commas within the summaries that we shouldn't replace with line breaks.

Hi, thanks for the answer, unfortunately something is wrong. The parsed text is inserted in the target field but the replaceAll doesn't replaced the comma with line break.

See the pictures of the setup and result after the transition that used it.

 

toolbox 0.png

 

toolbox 1.png

 

 

toolbox 2.png

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,060 views 13 18
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot