Smart Values for Custom Start/End Date field

jbrowne
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!
May 9, 2024

We have a custom date field in JPD that allows the user to select a quarter, a month, or a single date.  In an automation rule, I need to reference that date field and extract the date value. 

Using smart values, this:

{{customfield_20469}}

returns:

{"start":"2024-04-01","end":"2024-06-30"}

The following reference all return empty string
{{customfield_20469.value}}
{{customfield_20469.start.value}}
{{customfield_20469.start.toDate}}
{{customfield_20469.start.jiraDate}}
{{customfield_20469.toDate}}
{{customfield_20469.jiraDate}}

What do I use in the automation to get "2024-04-01" or "2024-06-30"?

1 answer

1 accepted

1 vote
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.
May 9, 2024

Hi @jbrowne -- Welcome to the Atlassian Community!

JPD is using this different version of a date field, apparently to store ranges, as needed.

And so text functions are needed to extract the values: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/

For example one way to do this with your field...

start date: {{issue.customfield_20469.match(".*start\":\"(.*)\",.*").toDate}}

end date: {{issue.customfield_20469.match(".*end\":\"(.*)\".*").toDate}}

One benefit of explicitly trying to match the format is seeing errors if Atlassian changes it in the future.

Kind regards,
Bill

jbrowne
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!
May 9, 2024

@Bill Sheboy - Perfect!  Thank you so much

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events