Use automation to clone ticket and then change epic link based on custom field

Malvina Garnier December 31, 2021

I use automation to clone a ticket automatically when needed. For exemple, in one project, I have an epic "desktop" and an epic "mobile" and I need the same ticket in both. I also need those two tickets to be independent in their workflow. 

I create a custom fields to mention in which epic I want this ticket to be clone. Then, I create an automation rule : 

- When creating a ticket, if this custom field isn't empty, clone the ticket

- Then, change the epic link of the clone ticket, using the custom field

For the custom field, I tried an URL field to complete the exact URL of the epic. I also tried a short text field to complete the key of the epic. 

In both case, it doesn't work. The ticket is well cloned but the epic is empty. Is there anyone who could help ? 

 

Here is my rule
Note that : {{customfield_11582.value}} = https://studiometa.atlassian.net/browse/SM-402 which is the link of the epic I want my issue to be

 

bef9a373-a89b-4444-af96-a47abd71eaf0.png

4 answers

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.
January 3, 2022

Hi @Malvina Garnier 

As you are using a URL to the epic/issue in that custom field, you could extract everything before the last forward-slash.  You may do that with the substringAfterLast() function: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#substringAfterLast-String-separator-

For example to get this from the triggering issue:

{{triggerIssue.customfield_11582.value.substringAfterLast("/")}}

If that does not work, please write that value to the audit log and then check that it contains what you expect.  You may not need that .value part.

Kind regards,
Bill

Malvina Garnier January 3, 2022

Thanks for your help :)

Actually I also tried to create an ohter custom field here I only mention the key of the epic I want on the clone tickets and it doesn't work. So, I don't think that this option may work.

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.
January 3, 2022

Thanks, Malvina.  Is this a company-managed or a team-managed project, as the Epic Link field only works for company-managed projects?

Malvina Garnier January 3, 2022

This is a company managed project 

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.
January 3, 2022

Would you please add a log action for that value before the edit, run the rule, and then post images of the updated rule and audit log details for the execution?  Thanks!

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 3, 2022

Hi Malvina,

I don't know that you will be able to use a url for the value for it to work. If you just have SM-402 as the value of the custom field, does that work? 

Malvina Garnier January 3, 2022

Nope it doesn't work either :'( 

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 3, 2022

So what is the error? 

And actually, just remove the .value part of the code for the custom field. 

Malvina Garnier January 3, 2022

I also tried, removing the .value part of the code mais it doesn't work either. 

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 3, 2022

So, what is the value in the customfield_11582 field for that issue? 

Malvina Garnier January 3, 2022

The value is the key of the epic I want on the clone ticket (in my case "SM-470") but the clone ticket still have an other epic. 

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 4, 2022

What does the audit log say for that action of updating the Epic Link? 

What does the history of the issue say for who populated the Epic Link? 

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 31, 2021

Are you cloning issues in a Company Managed or Team Managed project?

Malvina Garnier January 3, 2022

Hi ! In a company managed project. 

0 votes
Daniel Hummel December 31, 2021

As a workaround: You can save the epic link in a variable and then use it after cloning.

Malvina Garnier December 31, 2021

I try to do so but it doesn't work :'( 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events