Copy component from story to linked issue

Hizkeel Khan
Contributor
November 1, 2023

Hi,

How can I copy component field from story to linked issue story bug. 

I have created a custom field Story Bug. I have story Test 1 that is part of module 1 component. Now when I try story bug, I want this story bug to have the same component which test 1 have. 

While creating story bug, I will link the this story to my story bug so the component field should be copied automatically. 

Let me know if this is possible. 

1 answer

1 accepted

2 votes
Answer accepted
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.
November 1, 2023

Hi @Hizkeel Khan 

I am not quite following your exact scenario...It seems you have an issue of one type (e.g. Story), and when creating another issue want to link that to the first issue and copy the Component field.

That should be possible with an automation rule.

Using automation rules requires learning and experimentation.  I recommend trying to create the rule, and if you run into challenges the community can help.

To get you started on creating your rule, please refer to these documentation and example sources:

Kind regards,
Bill

Hizkeel Khan
Contributor
November 1, 2023

@Bill Sheboy - I have worked with automation rules but I think I wasn't able to explain it to you properly. Here is the automation rule I have created. 

 

Linked Issues - Components.png

Let me know if this is the right approach?

Hizkeel Khan
Contributor
November 1, 2023

Story Bug.png

Story bug link to Story.png

While I'm creating this story bug and I'm linking it to story. 

The story has already component field. I want that component field to be copied in the story bug I'm creating. 

What I want is whatever the component field story has, linked issue should have the same component field. 

I hope I have made it clear now. 
@Bill Sheboy 
@Nic Brough -Adaptavist- 

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.
November 2, 2023

When you branch to the linked issues, you are editing those linked issues, and not the newly created one.

An alternative is to gather the linked issues using the Lookup Issues action with JQL, and then use their components to set the value:

  • trigger: issue created
  • action: re-fetch issue (When using the issue created trigger, the rule can start so quickly that the data is not yet available.  Adding the re-fetch issue slows the rule down and reloads the data before proceeding.)
  • condition: issue type equals Story Bug
  • lookup issues: use JQL to get the linked issue
  • advanced compare condition: check if the lookup returned any results
    • first value: {{lookupIssues.size|0}}
    • condition: equals
    • second value: 1
  • action: edit issue, setting the component to 
    • {{lookupIssues.first.components}}
Hizkeel Khan
Contributor
November 2, 2023

Hi,

Thank you for the message. Can you please explain it in terms of automation rules like the Screenshots.
Also, I am seeing the component name at the end but the thing is that I have multiple components and I cannot specify component name. I hope you understand. 

Please help me out here and send me the screenshots of how this can be done. Thank you!

Hizkeel Khan
Contributor
November 2, 2023

This is what I have done and to be honest I have no idea what have I done. I thought It would be simpler but it is much more complicated than I thought. 

Please let me know the next steps because I need this badly and I have multiple number of components. @Bill Sheboy 

 

component - refetch.png

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.
November 2, 2023

As I described earlier, using automation rules requires learning and experimentation. 

We are all learning and so I encourage to take your time to understand how the rule works as you implement it.  Perhaps pair with another team member to share knowledge and the work.  That will help you both to maintain the rules in the future.

 

Next, you seem to now describe some urgency to complete this.  If you regularly have such requests / needs I recommend learning more to do this in Jira yourself, or investigating hiring an experienced Jira admin to help your team.

 

I provided the exact steps for the rule, based on there is one linked issue to the Story and one component value.  Let's adjust what I provided to help your changes.

The lookup issues with JQL is meant to return the data for the Story; that is the issue which is blocked by this new issue, Story Bug.  Your JQL to find it can use the linkedIssues() function: https://support.atlassian.com/jira-software-cloud/docs/jql-functions/#linkedissue

For your case, that would be to the trigger issue.  This query will find any issues the trigger issue is blocking, and it would be used in the Lookup Issues JQL.

issue IN linkedIssues( {{triggerIssue.key}}, "blocks" )

 

Once those issues are available, the component value may be used directly to edit the trigger issue, Story Bug.

To use a smart value to edit an issue field, like components, try the following:

  • select the field to edit, components
  • type in the smart value {{lookupIssues.first.components}}
  • the smart value will appear below the field
  • when it does, select it

 

Please try those things in your rule, test it, and share the results.

Hizkeel Khan
Contributor
November 3, 2023

Hi,

This is how the automation rule looks like:

component 1.png

Even though I am getting the following message but I am able to achieve what I wanted. 

 

changes are saved.png

Thank you so much! I cannot thank you enough. I have bothered you a lot but thank you for your patience. Kudos to you!

@Bill Sheboy 

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.
November 3, 2023

Automation rules do not display such messages after they edit issue fields. 

That message would only show if you manually create or edit an issue, setting the fields in a way that it no longer matches your board filter.  That seems like an unrelated problem.

 

Back to your automation rule, what do you observe happening when it runs now?  

Please post an image showing the audit log details with the rule execution.

Hizkeel Khan
Contributor
November 3, 2023

@Bill Sheboy - Here is the screenshot of the audit log

audit log.png

About the unrelated message that I'm seeing, what I can do so it is no longer shown. It doesn't affect my automation rule but everytime I create a story bug and linked it to the story ...it shows me this message then the story bug is shown on sprint board. 

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.
November 3, 2023

Please post images showing the component fields for the issues TP-131 (the source for the components) and TP-180 (the issue you are copying them to).  The rule seems to indicate the copy worked.

And, please post an image of the edit issue action for the rule.

 

 

About that message and the issue showing up: you may want to investigate that further.  For a linked issue, that would only show on the board if it was in the sprint.  (Child issues like sub-tasks will show if their parent is in the sprint.)

Hizkeel Khan
Contributor
November 3, 2023

@Bill Sheboy - Here are the screenshots:

 

Story.png

 

Story Bug.png

 

Edit Issues.png

 

Let me know if anything else is required

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.
November 4, 2023

Those images seem to indicate the rule worked: the component values from TP-131 were copied to TP-180.

What is not working as you expected?

Hizkeel Khan
Contributor
November 4, 2023

Everything is working according to the expectation. I was just curious about the toast message that is unrelated to this. 

Thank you so much for your patience and great help. 

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.
November 4, 2023

Awesome; I am glad to learn that helped you.

Like Hizkeel Khan likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events