I want to calculate how much time the ticket took from creation to resolve using automation. I have used
{{issue.resolutiondate.diff(issue.created).hours}} Hours
smart value but after running the automation I am getting the negative result (ex -97 hours) even if the resolved date is after created date
What I'd do first is to ensure both {{issue.created}}
and {{issue.resolutiondate}}
have valid, properly formatted values. You can test this by logging these dates
Created: {{issue.created}}
Resolved: {{issue.resolutiondate}}
If the difference still shows as negative, it might be because the smart value's .diff()
method interprets the order incorrectly. You can use the .abs()
function to handle this or the other way around
{{issue.resolutiondate.diff(issue.created).hours.abs}} Hours
or
{{issue.created.diff(issue.resolutiondate).hours.abs}} Hours
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No problem! I'm glad it helped.
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.