Forums

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

Difficulty Setting Epic Start Date to Earliest Child Date with Jira Automation

Colter Sherley January 30, 2024 edited

Hello all,

 

I have been following an answer (first answer) to a post provided by @Trudy Claspill  but I am having issues with the last steps.

 

I am nearly there in getting it to work in my environment. The only problem is I am on the Jira Data Center version and the field "Start Date" is not available as an option in the edit issue dropdown. It appears the workaround for this is to write it in JSON. So I have written the last step to Trudy's answer as follows under edit issue->additional fields:

 

{
"fields": {
"Target start": "{{lookupIssues.first.Target start}}"
}
}

 

Unfortunately when the rule is run, it errors out with an error that reads:

 

ABC-553 (Unparseable date: "" (customfield_11000))

 

Investigating a little further I did an export to CSV with the Target start field in the list of columns and the format looks like this "Nov/14/23 7:00 PM".

 

In the epic field on the Target start field it says:

 

"The targeted start date. This custom field is created and required by Portfolio for Jira.

 - Use the d/MMM/yy date format"

 

Does anyone know how I can fix this issue?

 

 

1.PNG 2.PNG

2 answers

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.
January 30, 2024

Hi @Colter Sherley -- Welcome to the Atlassian Community!

Have you tried using the format() function to set the date to the format you noted?

https://confluence.atlassian.com/automation/jira-smart-values-date-and-time-993924864.html

Kind regards,
Bill

Colter Sherley January 30, 2024 edited

Thanks for the reply, @Bill Sheboy . I did, I should have mentioned that in the post. This is how I did it. Did I setup the smart value correctly?

2.PNG 1.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.
January 30, 2024 edited

Thanks for that information, and FYI that I am using Jira Cloud and not Server, and so there could be at least three causes of what you see:

Most likely one is the field is not in the Lookup Issues result: https://jira.atlassian.com/browse/JIRAAUTOSERVER-877

When Lookup Issues was added for Jira Cloud, it only had about a dozen fields.  About a year later they added all of the other fields.  To check if the Target start is in the lookup, please use the log action to write this to the audit log after the lookup:

Target start: {{lookupIssues.first.Target start}}

If it is blank, the field is not supported yet.  A work-around can be to call the REST API function for an issue search with JQL and the Send Web Request action.  The web response can then be used in the same way as {{lookupIssues}}

 

Next, if the field is present, I do not know the format / field type of Target start with Jira Server.  Some of the Jira fields indicate "date picker" in the admin functions, but they are available to rules as text.  In that case, try first converting to a date, then adding the format:

{{lookupIssues.first.Target start.toDate.format("d/MMM/yy")}}

 

The final possibility is if the nested double quotation marks are causing the problem: one for the JSON and one for the format() function.  To solve that, a created variable could be used to first format the date.

Colter Sherley January 30, 2024

@Bill Sheboy I think you figured it out. I created a log action with exactly what you wrote and here is the result. Blank! So that would be why I am seeing the "unparseable date" error. 

I have never used the REST API so I am not sure where to begin on that. 

 

I already have target start and end dates populated at the story level. Is there another easy way to transfer these child dates up to the epic level not using lookup issues?

 

1.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.
January 30, 2024

Thanks for confirming that!

There are three ways to access batches of issues with automation rules, depending upon your version (i.e., Cloud, Server, Data Center).  They are:

  1. lookup issues (will not work for your scenario based on the limited fields)
  2. bulk-handling (will not work for your scenario based on the rule's structure / branching)
  3. send web request and issue search REST API function

Here is a how-to article for calling a REST API function with the Send Web Request Action: https://community.atlassian.com/t5/Jira-Software-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828

I believe the function you want is this one: https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/#searching-for-issues-examples

 

Please discuss this approach with your Jira Admin first as they may have other suggestions for how to solve this need.

 

 

Colter Sherley January 31, 2024 edited

Thank you for this information @Bill Sheboy

I am going to look into this with my Jira admin. In the meantime, I think I have created a temporary solution. It is not as good as the original solution, however. This required two rules that runs checks against the trigger issue when the sprint value changes. It then does comparisons of the trigger issues target start and end dates and then updates the related epics target start and end dates if the advanced compare condition is met.

 

Thank you for all of your help! It is greatly appreciated. I have learned a lot walking through this with you.

 

 1.PNG 2.PNG

Like • Bill Sheboy likes this
0 votes
Colter Sherley January 30, 2024 edited

  

Suggest an answer

Log in or Sign up to answer