Jira Automation to Copy Target Start / End to Cloned Issue

Steven Drury November 5, 2020

Hello, 

I'm trying to setup an automation that will copy values from Target Start and Target End to a linked issue. I have the automation set up and can get the cloned issue updating, but I am having trouble with the Target Start / End fields that are created by Advanced Roadmaps. 

I have the 'Edit issue' action running on linked issues, and am using the Additional Fields to set these values. If I use the following, the dates are copied but are one day behind the trigger issue. 

{
"fields": {
"Target start": "{{triggerissue.Target start}}",
"Target end": "{{triggerissue.Target end}}"
}
}

If I try to work around this by using .plusdays(1) (as in below) then I get 'Error parsing date string'. 

{
"fields": {
"Target start": "{{triggerissue.Target start.plusDays(1)}}",
"Target end": "{{triggerissue.Target end.plusDays(1)}}"
}
}

Where am I going wrong here? 

 

2 answers

1 accepted

4 votes
Answer accepted
Steven Drury March 25, 2021

This morning I have found a solution for this problem. When using the Clone Issue (or create/edit) function in Automation for Jira, setting the following under additional fields will clone the Target Start or Target End values and can handle date manipulation. 

Replace customfield_12345 with the id of your Target Start or Target End field. 

{
"fields": {
"customfield_12345": "{{issue.fields.customfield_12345.toDate("yyyy-MM-dd").plusDays(1).format("yyyy-MM-dd")}}"
}
}
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 26, 2021

Sounds like a good solution!

Wade Cornett June 30, 2021

@Steven Drury I am having the same issues you had, not letting the target start start/end date be formatted with yyyy-MM-dd format. I am following what you posted but am still not getting it. Is there any way you could post your full JSON script so I can see what im doing wrong?

Justin Kix December 21, 2021

@Wade Cornett did you get this figured out?

Wade Cornett December 21, 2021

I did not @Justin Kix . Are you running into the same problem?

Jacob Chan March 3, 2023

This helps!

1 vote
John Funk
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 6, 2020

Hey @Simmo  - This is the second time in a couple of weeks where people are having trouble in Automation with the Target Date. It "seems" to be a typical date field type, but it doesn't behave as one when using Automation. Thoughts?

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 6, 2020

Hey guys,

According to this Code Barrel ticket, the Portfolio and Advanced Roadmap fields are not supported yet:

https://codebarrel.atlassian.net/browse/AUT-1370

@Steven Drury   To learn which fields are in the JSON, and so potentially have smart values, please see this how-to article to use the REST API to grab an example issue for investigation:

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

Best regards,

Bill

Like John Funk likes this
Steven Drury November 8, 2020

Thanks @Bill Sheboy and @John

Glad I'm not the only one having an issue. I'm guessing it will eventually fall into support, but for now it's in limbo. The dates do have JSON fields available and can render as smart values, but any attempt to use the date functions to manipulate the fields or render as a different format fails (most functions under this link)

Like # people like this
Simmo
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 10, 2020

Hi @John Funk & @Steven Drury ,

I'm not familiar with Advanced Roadmaps but it sounds like they could be in a format / form that we don't understand. 

What I'd suggest you try is visiting https://support.atlassian.com/jira-software-cloud/docs/use-smart-values-to-manipulate-and-format-dates/ and seeing if you can use the toDate smart value then the plusDays and see if that helps?

Cheers,

Simeon.

Like Steven Drury likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.5.8
TAGS
AUG Leaders

Atlassian Community Events