How to modify value of custom date field with smart values

Tom Yan November 13, 2023

Hi, 

I am trying to modify the value of a date custom field using smart values for a Jira Automation, according to this documentation: Jira smart values - date and time | Cloud automation Cloud | Atlassian Support. 

I have printed out log messages to troubleshoot, and the issue appears to come from the fact that I am using a custom field (date), as .plusDays(14) works for the native "created" field. The Edit Issue action follows:

{
"fields": { "customfield_10022": "{{ issue.customfield_10022.plusDays(14) }}"}
}

customfield_10022 is "Target start"

What am I missing here?

 

Jira Automation Issue.png

2 answers

1 accepted

4 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.
November 13, 2023

Hi @Tom Yan -- Welcome to the Atlassian Community!

There are some extra spaces in your smart value expressions, so please try removing those.

And if that does not work...I have seen this symptom in other posts, where a date field in rules is somehow returned as text.

Please try adding toDate for a conversion before trying the increment, like this:

{
"fields": {
"customfield_10022" : "{{issue.customfield_10022.toDate.plusDays(14).jiraDate}}"
}
}

 

Kind regards,
Bill

Kian Stack Mumo Systems
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 13, 2023

@Bill Sheboy, great tip on the ".toDate". I just tried that out and it worked well. I thought I had tried that, but I must have done something wrong previously! 

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.
November 22, 2023

Hi @Tom Yan 

Just following up to check if this solved your question or if there is more to do.  Thanks!

Tom Yan November 22, 2023

Hi Bill, 

Thanks so much. That did the trick!

Like Bill Sheboy likes this
0 votes
Kian Stack Mumo Systems
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 13, 2023

@Tom Yan

 

You could raise a ticket with Atlassian.. I cannot get any functions to work on the custom field of type "date".

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events