Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Copying the target parent's component field to a subtask when moving subtask to a new parent

david catriel
Contributor
March 9, 2023

Hi everyone

 

Having a hard time finding out the smart value to use for this one. We use components on both issues and subtasks, but the latter are automatically set to be a copy of the parent's component value when the subtask is created. No issues there.

 

But if a subtask is then moved to a new parent, I need to be able to update the component to whatever value is now available on the target parent, and am having a hard time finding the smart value for that.

 

This is the closest I've gotten so far, but am not getting any results. I'm assuming the smartvalue would have to be something like {{issue.changelog.parent. ...}} but cannot find any good examples on this.

 

Any suggestions?  

 

subtask component issue.jpg

3 answers

1 accepted

1 vote
Answer accepted
Stefan Salzl
Community Champion
March 9, 2023

Hi @david catriel 

  1. smart values are case sensitive. Try {{issue.parent.Components}}
  2. you could also use the option "Copy from parent" for the field to be changed in your edit issue action --> see screenshot below
  3. However:
    both of the above mentioned options might not always work correctly as this could be a timing issue. You could try to add one or several re-fetch data action. This will delay the rule a little bit and processing of the issue update can be done completely before grabbing parent´s data (or data of correct parent ;) ). image.png

Hope this was helpful.

Best
Stefan

Stefan Salzl
Community Champion
March 13, 2023

Hi @david catriel ,

yeah that‘s the timing issue I mentioned. The new parent is not detected at that time therefore the components of the old prent gets copied. I could reproduce this behaviour and the workaround with slowing down the automation rule with some re-fetch actions worked in my system.

Nevertheless guess it might also work with the change-log but the result from the changelog might need to be formated (not quite sure).

did you already try to write the output of the changelog to the audit log to see what and in which format you get the information? If you get a list/array of ids i guess it should be possible to simple write the changelog to the subtask‘s field. You can find detailed description of which format the different fields expect:

https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/

Best
Stefan

1 vote
david catriel
Contributor
March 13, 2023

Ok, gotcha now. The timing issue was definitely the problem. I added the re-fetch and just changed the rule to be a simple Copy, and it works like a charm now. 

 

For anyone else looking into this issue, here's the final setup:

subtask component issue.jpg

Stefan Salzl
Community Champion
March 14, 2023

Awesome 👍🏼👍🏼 great job 💪🏼💪🏼

Amd thanks for sharing ypur solution in details. Very much appreciated to help other users with this kind of documentation 🙌🏼

Like david catriel likes this
0 votes
david catriel
Contributor
March 13, 2023

@Stefan Salzl thanks for the answer and apologies for the late reply. I've been trying that out as well, and although there are no errors and the rule's audit log says the values were copied, nothing actually is. I have a feeling that this is because what's being copied is the component value from the current parent and not the new one.

 

That's why I was hoping there'd be a way to reference the new parent via something like "{{issue.changelog.parent.toValue.Components}}. 

 

Any ideas on how to reference the values in the target parent instead of the current one?

Suggest an answer

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

Atlassian Community Events