Jira Automation: How to copy Description field into new issue created?

Luis Villamizar March 7, 2024

In this scenario, I have a Task (DRAFT-01) and I want to reuse the description from this task when a new User Story is created. 

 

I created a variable {{DraftText}} to fetch the issue description {{issue.description}}

 

Both Task and new user stories are under the same project, however they're no related in any other way. 

 

Would this be the right approach for this scenario? 

 

Screenshot 2024-03-07 at 11.54.46 pm.png

1 answer

0 votes
Bill Sheboy
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.
March 7, 2024

Hi @Luis Villamizar 

First thing: what do you want to happen to the existing description in the created issue: add to it, replace it, something else?

Next, this will not work as your rule is shown, because...

  • with the branching, the created variable will go out of scope when the branch completes, and disappear
  • branches like this run in parallel and asynchronously, and are not guaranteed to finish until the end of the rule; thus that last edit may occur before the branch finishes!

As you are using Data Center version, you may instead use the Lookup Issues action with your JQL.  That will load the data for the "draft text" issue, for use later with:

{{lookupIssues.description}}

 

Some suggested changes to your rule could be:

  • trigger: issue created
  • action: re-fetch issue (It is advised to use this action after the Issue Created trigger due to possible timing problems.  Otherwise, the trigger can fire so quickly that some fields will be empty.)
  • condition: issue type is story
  • action: lookup issues, with JQL to get your draft text issue
  • action: edit issue, making changes to the description as needed

 

Kind regards,
Bill

Luis Villamizar March 7, 2024

Thanks Bill !

This worked perfectly, it added to the description in the created issue. 

Like Bill Sheboy likes this
Bill Sheboy
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.
March 7, 2024

Awesome; I am glad to learn that helped!

Just to confirm, did you want to add to, or replace the description?  If it was "add to", your field edit could look like this to add the draft text after the original value:

{{issue.description}}
{{lookupIssues.description}}
Like Luis Villamizar likes this
Luis Villamizar March 7, 2024

Correct, I wanted to add to the description so 

{{issue.description}} 

keeps the original text from Created Issue and its not overwritten by  

{{lookupIssues.description}}

 

Bill Sheboy
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.
March 7, 2024

Then if you include both smart values as I show above, that will add the draft text afterwards.  Please try that and let me know if it works as you expected.

Suggest an answer

Log in or Sign up to answer