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"?
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
@Bill Sheboy - Perfect! Thank you so much
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.