Why isn't this Automation adding components automatically to new sub-tasks?

Darryn November 17, 2024

I am trying to have a new sub-task automatically inherit the parent's component.

Why is the below automation now working?

Screenshot 2024-11-18 133939.png

2 answers

1 vote
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 19, 2024

Hi @Darryn 

Looking at the original rule you posted, it uses the Issue Created trigger.  That trigger may fire so quickly that some data may not yet be available to the rule yet.  This particularly applies to smart values like {{issue.parent}}, {{issue.subtasks}}, etc.

The "fix" for that timing problem is to always add the Re-fetch Issue action immediately after the Issue Created trigger.  This will slow down the rule a bit and reload the data before the rule continues.  Please try adding that action and re-testing.

Kind regards,
Bill

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.
November 17, 2024

Hello @Darryn 

What is the output in the rule execution log?

Is the rule scope a single project or multiple projects?

What do you see in the Components field for the issue that triggered the rule?

Darryn November 17, 2024

Hi @Trudy Claspill 

Do you mean the "audit log" when you say output in the execution log? Honest question, I can't find a "rule execution log" - the Audit log says:
Screenshot 2024-11-18 135757.png

The scope is just a single project.

On all test issues I've created (including KM-547 above), the Component field value has remained "none"...
Screenshot 2024-11-18 135942.png

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.
November 17, 2024

Yes, indeed, I did mean the log for the individual execution of the rule, which is found on the screen labeled Audit Log when viewing the rule. You provided what I was asking for.

I am assuming you have confirmed manually that the Components field in the parent issue is not empty.

What is the project type for the project against which the rule is running? Get that information from the View All Projects page under the Projects menu.

Can you use the Log action just before the Edit action to print into the audit log the value of the Components field from the parent issues? You can access that value with 

{{issue.parent.components}}

Then create a new subtask and let us know the audit log output.

Darryn November 17, 2024

Great.

Yes, the parent has a component (we use components as our different boards in our team)

Project Type: company managed software

I added log action with {{issue.parent.components}} and it appeared as an ID number! So I changed the code to {{issue.parent.components.name}} and it now appears as the name of the parent's component.

I also change my Then: Edit Issue fields to use code {{ parent.fields.components[*].name }} but even this didn't work - the components on the new sub-task are still 'none'.

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.
November 18, 2024

Has the rule undergone multiple edits? Sometimes rules stop working for non-obvious reasons after repeated edits. You might try creating the rule a new from scratch.

Can you check if there is more than one field named Component or Components?

Use the information from this page to print all the fields from a sample parent issue and subtask and review the output to see if there is more than one field with that name.

https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

You could also try using advanced editing with JSON to copy the values to the child issue. 

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

Suggest an answer

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

Atlassian Community Events