Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to create rules that work on Date type of fields in JPD

Lamija Pasalic
July 24, 2025

- Cloud Deployment

- JPD

- I am admin of the project. 

- Building an automation rule that tries to set the value of the custom field Duration (type: number) based on the difference between two custom fields: Project Start (type: date) and Project Target (type: date). While the rule runs successfully, I'm unable to get the right value. 

- Tried to use different formula likes {{daysBetween(Project target, Project start)}} but unable to get anything meaningful. 

If I add some debugging:

Debugging Duration Calculation:
Project Start: {{Project start}}
Project Target: {{Project target}}
Calculated Duration: {{daysBetween(Project target, Project start)}}

 

What I get in output is this:

Debugging Duration Calculation: Project Start: {"start":"2025-10-01","end":"2025-10-01"} Project Target: {"start":"2025-12-31","end":"2025-12-31"}

indicating that even though Project Start and Project Target are of type date, the include somehow a range. 

I tried many different ways to parse (json parse, match) and try to get only one date out of the range, but I always get empty strings. {{Project start}} is simply evaluating to null or an empty string from the very beginning, before any .jsonParse, .match, or .toDate can even try to act on it.

How can I get to the date values inside the fields of type Date in JPD? 

1 answer

1 accepted

2 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 Champions.
July 24, 2025

Hi @Lamija Pasalic -- Welcome to the Atlassian Community!

JPD date fields are JSON represented as text, and contain a single date or a range of dates.  They must be converted for use as date types, such as using the jsonStringToObject() function:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#jsonStringToObject--

 

For example, and assuming your smart values have IDs of customfield_12345 and customfield_67890, and each have a single date value, this would be the calendar days difference:

{{jsonStringToObject(issue.customfield_12345).start.toDate.diff(jsonStringToObject(issue.customfield_67890).start.toDate).days}}

UPDATE: After a quick test, it appears the custom field ID values must be used for the syntax I showed.  Please identify the ID values using this how-to article:

https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

 

Kind regards,
Bill

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events