Forums

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

How to Copy the Latest 'Target End' Date from Linked Stories to a Custom Field in an Epic

Diego Martínez December 17, 2024

 

 

Hello, good morning everyone!

I would like to achieve something in Jira. Specifically, I want the "Target End" value in my Epic to be copied as the maximum value from the linked subtasks.

In other words, I want the Epic to take the latest or maximum date from the linked tasks, which are of type "Story" and appear as issues in the Epic. I would like this value to be copied into a custom field within my Epic task.

The reason for this is that the tasks linked to my Epic have different dates, and I would like to get the latest or maximum date and copy that value to a custom field in my Epic task. How can I achieve this?

2 answers

1 accepted

1 vote
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.
December 18, 2024

Hi @Diego Martínez 

You describe trying to update the Target End date field in an Epic using the maximum value of the child issue Stories.

As you are using Jira Data Center, I believe there is only one way to do that to get the value: calling the REST API to access the maximum value for the edit.

 

For Jira Cloud, this is easy as the Lookup Issues action supports all issue fields.  That is not the case for the Data Center version: https://jira.atlassian.com/browse/JIRAAUTOSERVER-877

There are two possible workarounds for this scenario, depending upon what is needed for the value.  You need the second one...

1) When the rule has no branches, or just needs to report on the field value, such as with an email or Slack message, the bulk-handling feature of the Scheduled Trigger or branches can help: https://confluence.atlassian.com/automation/run-a-rule-against-issues-in-bulk-993924653.html

In this case, one replaces the {{lookupIssues}} smart value with the plural {{issues}} one.

 

2) When the rule already has a branch or needs to edit an issue, one may instead use the Send Outgoing Web Request action to call the REST API for an issue search with JQL.  Then use the web response smart value to sum the field.

Here is a how-to article for calling the REST API from a rule: https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828

I believe this is the REST API endpoint you need: https://docs.atlassian.com/software/jira/docs/api/REST/9.13.0/#api/2/search-search

Finally, you may need to use the custom field id rather than the field name as a smart value.  This how to article will help identify that value for your field: https://confluence.atlassian.com/automation/find-the-smart-value-for-a-field-993924665.html

 

Kind regards,
Bill

Diego Martínez December 18, 2024

respuesta json.png

 

automarion t2.png

Thank you very much.

I followed the steps to obtain the information with the web request, but I still have the doubt about how to use this information to get the maximum value of the customfield and copy it to a field that I have in my current issue (where the automation is triggered). Could you help guide me?

Like Bill Sheboy likes this
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.
December 18, 2024

First thing: the call to the REST API should be before the attempt to edit the issue fields.

Next, as you can see in the audit log, the issues are in the web response body, with the custom field under the fields attribute.  That will return as text, and so must be converted into a date so the max function will work.  Please try writing this to the audit log to confirm it matches what you expect:

{{webResponse.body.issues.fields.customfield_10904.toDate.max}}

 

Like Diego Martínez likes this
Diego Martínez December 18, 2024

Thank you so much!

I put this in the audit log: Prueba del log: {{webhookResponse.status}} {{webhookResponse.body.issues.fields.customfield_10904.toDate.max}}  and it worked!


Like Bill Sheboy likes this
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.
December 18, 2024

Awesome; I am glad to learn that helped!

0 votes
Trudy Claspill
Community Champion
December 17, 2024

Hello @Diego Martínez 

Your post tags say you are using a Cloud deployment which would indicate you are using Jira Cloud - the software as a service product.

But your tags also include jira-data-center.

Which product are you actually using?

If you click on the Help button in Jira and click About Jira, what information do you get?

Have you tried to create this rule? If so, please show us what you have so far.

Diego Martínez December 18, 2024

Hello @Trudy Claspill

Yes, I'm using Jira data center, sorry. 

This is an example of how I have tried to create the automation.

 

automation iniciativas.png

Diego Martínez December 18, 2024

I also have this smart value

{{#issuesInEpic}}{{#if(customfield_10904)}}{{max(customfield_10904)}}{{/}}{{/}}


And I don't have lookupissues in this version of data center :( 

Suggest an answer

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

Atlassian Community Events