Forums

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

The problem is related to automation and custom fields.

Kari Laine February 23, 2023

"I am new to JSM and could not find anything that is 100% similar to my issue.

I have created three custom fields. Fields 1 and 2 relate to date/time, and their format is (date/time[Time stamp]). The third custom field is the duration in minutes.

The idea is to calculate how long it took to resolve the solution.
For example, Duration = resolved - created,
but in my case, Duration = custom2 - custom1.

I can create an automation that writes the value (in minutes) to the duration field when the case is closed.
This "code" is working fine: {{created.diff(resolved).minutes}}.

However, I want to use custom fields 1 and 2 instead of the created and resolved fields.
I have tested:
{{custom_field1.diff(custom_field2).minutes}}
{{"custom_field1".diff("custom_field2").minutes}} etc....without success :(

1 answer

1 accepted

2 votes
Answer accepted
John Funk
Community Champion
February 23, 2023

Hi Kari,

Try this: {{issue.First Field.diff(issue.Second Field).minutes}}

where First Field and Second Field are the EXACT names of your fields (including case).

Or this one using the field ID

{{issue.customfield_10156.diff(issue.customfield_10176).minutes}}

where the 10156 and 10176 are the actual IDs of your custom fields. 

Kari Laine February 23, 2023

Hi John,

 

Thanks for the quick reply, first solution worked well:

{{issue.First Field.diff(issue.Second Field).minutes}}

Thank you :)

Like John Funk likes this
John Funk
Community Champion
February 23, 2023

Great! Glad to help.

Like Kari Laine likes this

Suggest an answer

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

Atlassian Community Events