Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Automation to Sync Dates Between an Initiative in JIRA Software and an Idea in JIRA Product Delivery

Mike Gargano
Contributor
December 8, 2022

I've been working to setup JIRA Product Discovery for my group, and everything has been great thus far. 

We use initiative tickets as parents to epic tickets, and we're using JIRA Product Discovery in our Product Team for Roadmapping, Prioritization, and Discovery. 

I have setup a handful of automations that keep our initiative tickets that are linked delivery tickets in-sync with their idea counterpart. 

However, I can not figure out how to get a date field to stay in-sync. I believe it has something to do with how dates are stored in JPD. 

I tried using a custom JSON, because I couldn't target the date field in the simple automation UI.

{
"update": {
"customfield_10772" : {
"set" : {
"{{triggerissue.customfield_10742}}"
}
}
}
}

 This should work but I get an error:

 

Error while parsing additional fields. Not valid JSON.
I believe this is because the field is returning the following based on some logging I setup
{"start":"2023-01-28","end":"2023-01-28"}
I'm honestly not sure to go from here because I can't figure out how to get the field to format correctly to be accepted by a custom date picker in JIRA Software and vice versa with a field coming from JIRA Software going into Jira Product Discovery

I'm trying to get the date fields to sync for better roadmapping and preventing our PMs from having to do double the work between JIRA Software and JIRA Product Discovery. 

Screenshot 2022-12-08 at 12.05.59 PM.pngScreenshot 2022-12-08 at 12.06.15 PM.png

3 answers

1 accepted

1 vote
Answer accepted
Tanguy Crusson
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 9, 2022

@Mike Gargano I've asked an engineer on the team to give more details about the format the field excepts. 

Mike Gargano
Contributor
December 12, 2022

Awesome, thank you @Tanguy Crusson !

Martin Sturm
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 13, 2022

Hello @Mike Gargano , the date field in JPD accepts a JSON string with the start and end property being ISO 8601 date strings.

This is because JPD dates are conceptually intervals as we allow for example values like "Q3 2023" or "Feb 2024".

Like # people like this
Mike Gargano
Contributor
December 13, 2022

Hey @Martin Sturm , I appreciate you taking the time to respond.

So how would I parse that in JSON coming in from JIRA Software? or going from JIRA Product Discovery to JIRA Software which is setup differently.

I don't think I've ever run into anything like this, I'm not sure how to write the JSON for this, and I couldn't find anything using my google-fu.

Martin Sturm
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 13, 2022

Hello @Mike Gargano , unfortunately I am not very versed when it comes to A4J - what exactly are you getting from JSW?

If it's a string in YYYY-MM-DD (or you can convert it into such a string) would you be able to create a JSON string like this?

{
start: $dateString,
end: $dateString,
}

Then you could set the field with this string and it would show up in JPD correctly as a "date with day granularity".

Like # people like this
Mike Gargano
Contributor
January 3, 2023

Hey @Martin Sturm , thank you for your response, I apologize for my delayed reply, I got kinda busy towards the end of the year. I will give this a try and report back with how it goes! 

Like Martin Sturm likes this
Mike Gargano
Contributor
January 10, 2023

Hey @Martin Sturm 

I tried this: 

 

{
"update": {
"customfield_10742": {
"set" : start: {{triggerIssue.customfield_10772}},
end: {{triggerIssue.customfield_10772}},
}
}
}

And I'm still getting an error "Error while parsing additional fields. Not valid JSON."

Mike Gargano
Contributor
January 10, 2023

I tried formatting this a couple different ways. This also didn't work. 



"customfield_10742": {
start: {{triggerIssue.customfield_10772}},
end: {{triggerIssue.customfield_10772}},
}

Martin Sturm
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 16, 2023

Hello @Mike Gargano - as I said, I am no expert on this matter, but can you do some kind of string concatenation or a JSON.stringify on the value side of things?
Because if I interpret your code correctly you would end up trying to set a string based custom field with an JSON object, right?

 

"customfield_10742": JSON.stringify({ 
start: {{triggerIssue.customfield_10772}},
end: {{triggerIssue.customfield_10772}},
}

and maybe the YYYY-MM-DD conversion for the value that you mentioned above already.

Tanguy Crusson
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 20, 2023

@Bopanna from our support team just found a workaround for this I believe!

He just shared this with me, and I believe it should help you @Mike Gargano 

----

 

I tried to have a go at this by creating an automation rule and using advanced JSON editing to populate the JPD Date field. I was able to set the date using the below JSON format:
{
    "fields": {
        "customfield_10637":"{\"start\":\"{{now.jiraDate}}\",\"end\":\"{{now.jiradate}}\"}"
}
}
If we use {{<date>.jiradate}}, we should be able to format it to yyyy-dd-mm format as mentioned here
Mike Gargano
Contributor
February 6, 2023

@Tanguy Crusson , I tried this and the automation kicked back an error:

Error editing issues
FPD-304 (We couldn't save your changes. Copy your content, then try reloading the page.) 

This is how I formatted the JSON: 


{
"fields": {
"customfield_10742":"{\"start\":\"{{customfield_10772.jiraDate}}\",\"end\":\"{{customfield_10772.jiradate}}\"}"
}
}
Bopanna
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 7, 2023

Hello @Mike Gargano

Bopanna here from the Atlassian Cloud Support Team! 

In order to investigate the error further on our end, I would kindly request you to raise a support ticket with us here, please: https://support.atlassian.com

Thank you!

Best,
Bopanna

Mike Gargano
Contributor
February 14, 2023

After working with Marcelo on the Atlassian Support Team we were able to determine I was missing the TriggerIssue Smart Variable. The Solution ended up being:

 

{
"fields": {
"customfield_10742":"{\"start\":\"{{triggerIssue.customfield_10772.jiraDate}}\",\"end\":\"{{triggerIssue.customfield_10772.jiradate}}\"}"
}
}
Like # people like this
Tanguy Crusson
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 16, 2023

Awesome, thanks for letting us know @Mike Gargano ! I'll add this to the FAQ

Like # people like this
Jamey Hawkins
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 19, 2023

I am receiving an error when attempting to use the answer above.  Asking for the proper formatting and then when I try to implement a short text field it posts a bit of the code rather than a date at all.  Any suggestionserror.jpg

 

{
"fields": {
"customfield_12448":"{\"start\":\"{{triggerIssue.customfield_12447.jiraDate}}\",\"end\":\"{{triggerIssue.customfield_12447.jiradate}}\"}"
}
}
3 votes
Laura Kessell
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 6, 2023

Is this on the feature roadmap? It seems so important to keeping the two systems in sync!

Tanguy Crusson
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 7, 2023

Yes, the team's currently investigating that one actually 👍

Like # people like this
0 votes
Katja Arendt
Contributor
April 3, 2024

Thanks to all for the solution. It worked fine for me. I just wanted to share my automation, as I included not only the trigger, when the Project Target gets changed but also the trigger, if a new delivery ticket gets added to the idea.

 

Trigger is the value change of the Project Target (in my case customfield_10081)

Whole Picture

Screenshot 2024-04-03 144350.png

Detailed view of each step

a. checking that i am in the right project

Screenshot 2024-04-03 144614.png

b. branch that it changes the dates only on delivery issues of the idea

Screenshot 2024-04-03 144923.png

c. I restricted the update of the due date to specific types and projects. You can just leave that if you want to update the due date in every delivery ticket.

Screenshot 2024-04-03 145123.png

d. I worked with a smart value variable. The smart value I put in was (thats what Mike here postet last as solution):
{{triggerIssue.customfield_10081.substringAfter("\"end\":\"").substringBefore("\"")}}

Screenshot 2024-04-03 145418.png

e. put in the duedate in the related delivery tickets via edit issue advanced

{
"fields": {
"duedate": "{{endDate}}"
}
}

 Screenshot 2024-04-03 145629.png

f: and in the end a litte log note to check what was inserted as the due date: via Log action:

Log message:

DueDate in UDO Epics set to: {{triggerIssue.customfield_10081.substringAfter("\"end\":\"").substringBefore("\"")}}

Screenshot 2024-04-03 145806.png

DONE :) 

 

Trigger is the adding of a new delivery ticket to an idea

Whole picture:

Screenshot 2024-04-03 150006.png

a. Trigger is that a new ticket is linked (implements, is implemented by)

Screenshot 2024-04-03 150107.png

b. again I restricted the automation to a specific project. If you want to update every added delivery tickets just leave this step out

Screenshot 2024-04-03 150251.png

c. again worked with a variable:

Smart value is: {{destinationIssue.customfield_10081.substringAfter("\"end\":\"").substringBefore("\"")}}

as you can see here you have to work with destinationIssue and not with triggerIssue.

Screenshot 2024-04-03 150431.png

d: edit issue - issue due date to new linked delivery ticket


{
"fields": {
"duedate": "{{endDate}}"
}
}

 Screenshot 2024-04-03 162132.png

e: and again a litte log note to check what was set as due date in the linked delivery ticket:

Log Message:

DueDate in new linked UDO delivery ticket set to: {{destinationIssue.customfield_10081.substringAfter("\"end\":\"").substringBefore("\"")}}

Screenshot 2024-04-03 162256.png

Guy Geron
Contributor
July 8, 2024

Hi @Katja Arendt , 

First thanks for all these tips! 🙏🏼

QQ - how did you find the id of the Project target field? 

Guy Geron
Contributor
July 9, 2024

I've just found a "way" to find the custom field. This was suggested by @Tom Rouillard back in 2021: https://community.atlassian.com/t5/Jira-questions/How-do-you-find-a-field-ID-in-a-team-project/qaq-p/1710958

Do a JQL search using the custom field exposed as a column in the search result, and click on the custom field column to sort. 
The JQL will automatically readjust the JQL to ORDER BY the custom field with its ID. 

Guy Geron
Contributor
July 9, 2024

I also tested your approach @Katja Arendt , and it works nicely! Thank you 🙏🏼

Like Katja Arendt likes this
Katja Arendt
Contributor
July 15, 2024

Hi, also one easy way, which I use all the time is described here 

https://confluence.atlassian.com/jirakb/how-to-find-any-custom-field-s-ids-744522503.html

It is option 2:

you can just copy that link (

  • <JIRA_BASE_URL>/rest/api/latest/issue/BS-1?expand=names )

to your brower, insert your url and add it to your favorites in the browser.

For me it is the fastest way to find any custom field id of any field in any project. :) 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events