JWM Automation Help
Asked by Yasmine:

Hi Everyone,

I'm trying to set an automation for the following scenario and i'm struggling with once piece.

Automation: When issue is created, and issue type is X, and field A is one of D, E, F, then create sub-task.

What i need is for the subtask summary to copy the entry selected in field X on the parent issue. How do i do that?


Answers:
author: John Funk
body: Hi Yasmine,

If the parent is the one created before you create the sub-task, then in the Summary field of the Sub-task put {{triggerIssue.Field X}} where Field X is the EXACT name of the guild you are copying from.

comments: author: Yasmine
body: Hi John,

I set up the automation as follows:

When Value changes for field x, and field x is one of a, b, c then create sub-task and set summary {{triggerIssue.cf\[10169\]}}.

The sub-task was successfully created, but the field value did not copy over. What am i missing?

I used this resource to find the field ID

<https://community.atlassian.com/t5/Jira-Software-questions/How-do-you-find-a-field-ID-in-a-team-project/qaq-p/1710958>


author: John Funk
body: The correct syntax is {{triggerIssue.customfield_10169}}


author: Yasmine
body: It worked!! Thank you so much John!


author: John Funk
body: Great! Happy to help.


author: Hitesh
body: Hi Yasmine,

To copy the value of a field from the parent issue to the sub-task summary, you can use the following automation rule in Jira:

* Create a new automation rule with the trigger of "Issue created" and condition of "Issue type is X" and "Field A is one of D, E, F".
* Add an "Create issue" action for the sub-task.
* In the "Summary" field of the sub-task, use the smart value {{issue.parent.fields.X}} to copy the value of field X from the parent issue.

<br />

This will create a sub-task whenever an issue is created with issue type X and field A is one of D, E, F. The summary of the sub-task will be set to the value of field X on the parent issue.

Hope this helps.

Regards,

Hitesh.

comments: author: Yasmine
body: Hi Hitesh,

I set up the automation as follows:

When Value changes for field x, and field x is one of a, b, c then create sub-task and set summary {{issue.parent.fields.cf\[10169\]}}

The sub-task was successfully created, but the field value did not copy over. What am i missing?

I used this resource to find the field ID

<https://community.atlassian.com/t5/Jira-Software-questions/How-do-you-find-a-field-ID-in-a-team-project/qaq-p/1710958>


author: Hitesh
body: It's possible that the issue object that is being used to create the sub-task does not have the custom field value in its memory. In this case, you may need to explicitly request the value of the custom field from the parent issue before setting it as the summary of the sub-task.

Here is an example of how you could modify your automation rule to include this step:

When Value changes for field x, and field x is one of a, b, c then:

* Retrieve the value of the custom field from the parent issue: {{issue.parent.fields.customfield_10169}}
* Create sub-task and set summary to the retrieved value: {{issue.parent.fields.customfield_10169}}

Replace "customfield_10169" with the actual ID of your custom field, which you can confirm using the resource you mentioned in your question.

This should ensure that the custom field value is copied over to the summary field of the sub-task when the specified field changes in the parent issue.

Let me know if this helps.


author: Yasmine
body: I don't see "Retrieve the value" as an option under actions to perform


author: Hitesh
body: I apologize for the confusion. "Retrieve the value" is not a specific action in Jira automation, but rather a step that you can include in your automation rule to ensure that the custom field value is available when creating the sub-task.

Here is an updated example of how you could modify your automation rule to include this step:

When Value changes for field x, and field x is one of a, b, c then:

* Retrieve the parent issue object: {{issue.parent}}
* Retrieve the value of the custom field from the parent issue: {{issue.parent.fields.customfield_10169}}
* Create sub-task and set summary to the retrieved value: {{issue.parent.fields.customfield_10169}}

Replace "customfield_10169" with the actual ID of your custom field, which you can confirm using the resource you mentioned in your question.

In this updated example, we first retrieve the parent issue object using the {{issue.parent}} syntax. This will give us access to all the fields and values of the parent issue, including the custom field value that we need to copy over.

Next, we retrieve the value of the custom field from the parent issue using the {{issue.parent.fields.customfield_10169}} syntax. This will ensure that the custom field value is available when creating the sub-task.

Finally, you create the sub-task and set the summary to the retrieved custom field value.

I hope this helps!