Posting Date in a JDP field

Martin
Contributor
June 29, 2023

Hello,

 

I am struggling with an automation. Simple, I want to add today's date to a custom field. I used the doc here: Product demo: Automation for Delivery 🤖 - Atlassian Community

 

Here is my statement:

{
"fields": {
"customfield_10552":"{\"start\":\"{{now.jiraDate}}\",
\"end\":\"{{now.jiradate}}\"}"
}
}

 

 

Here is the error I get:

Error while parsing additional fields. Not valid JSON.

 

Thank you for your help!

3 answers

1 accepted

3 votes
Answer accepted
Erin Quick-Laughlin
Contributor
June 29, 2023

I believe it's because of the quotes surrounding the object that contains start and end props.

When I post your code into jsonlint.com, it shows this:

Screenshot 2023-06-29 120023.png

 

After I took those out, it also threw errors on the escapes, so try this?

{
"fields": {
"customfield_10552": {
"start":"{{now.JiraDate}}",
"end":"{{now.Jiradate}}"
}
}
}

BTW what kind of custom field type is this?

Martin
Contributor
June 29, 2023

Thank you Erin. I'm bookmarking this tool.

 

It's a date field in JDP. 

I used the exemple provided by @Hermance NDounga in her documentation. Copy/Paste and changed the field number only.

Like • Erin Quick-Laughlin likes this
1 vote
Martin
Contributor
June 29, 2023

I asked also a new friend, that sometimes, knows a lot. His name is chatGPT. It gave me the right formula and it works:

 

In your JSON, there is a small issue with the casing of the jiraDate placeholder. In Jira Automation, the correct casing for the current date placeholder is {{now.JiraDate}} with an uppercase "J" and "D".

Here's the corrected JSON:

 

{
"fields": {
"customfield_10552": "{\"start\":\"{{now.JiraDate}}\",\"end\":\"{{now.JiraDate}}\"}"
}
}

 

This JSON assigns the current Jira date to both the start and end properties within the customfield_10552 field.

0 votes
Chris Timms
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.
June 29, 2023

Commenting to track if anyone comes up with a solution to this one. My own investigation suggests it might be related to escaping special characters correctly, bbut I haven't been able to invest the time to look into it deeply.

Regards,

-C

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events