I'm trying to get the resolution time since the SLA in Service Desk is using + / - in the time. I just need the number of days spend on a ticket. I used the following formulas. but it did not give me any result. Am I missing anything?
<!-- @@Formula: issue.get("resolved")==null ? null : (issue.get("resolved").getTime() - issue.get("created").getTime()) / 1000 / 3600 / 24 -->
<!-- @@Formula: issue.get("resolutiondate")==null ? null : (issue.get("resolutiondate").getTime() - issue.get("created").getTime()) / 1000 / 3600 / 24 -->
Thanks David! It works now! I should've thought of that.
I've another field using your add-on. It's working but it throws the following error on my logs.
CalculatedDateField: error evaluating formula: Sourced file: inline evaluation of: `` org.apache.commons.lang.time.DateUtils.addDays(issue.get("customfield_13702"),1 . . . '' : Method Invocation org.apache.commons.lang.time.DateUtils.addDays
Here is the code I'm using.
<!-- @@Formula: org.apache.commons.lang.time.DateUtils.addDays(issue.get("customfield_13702"),30) -->
As for your other problem, can you post the entire error? There must be another line following this one.
Can you possibly try the following SNAPSHOT release and tell me if it fixes your issue? https://innovalog.atlassian.net/secure/attachment/25267/jira-misc-custom-fields-1.5.9-SNAPSHOT.jar
Thanks David! I'm currently testing them. So far, you really need to reindex when you add a calculated field. If you don't it would still show the error.
Here are the steps I did.
1. Upload Add-On
2. Background Reindex
3. Created Custom Field
4. Background Reindex
While the Reindex is not yet finished, the logs are being filled with the
[innovalog.jmcf.fields.CalculatedDateField] CalculatedDateField: error evaluating formula: Sourced file: inline evaluation of: `` org.apache.commons.lang.time.DateUtils.addDays(issue.get("customfield_13702"),1 . . . '' : Method Invocation org.apache.commons.lang.time.DateUtils.addDays
After reindex, no sign of the error message. I haven't tried locked reindex but I would assume that the error messages would not be thrown.
The correct formula is the second one.
To verify the syntax of your formula, you can look into your log gile (atlassian-jira.log) for errors.
To verify that the formula is entered in the appropriate location, replace is with: @@Formula: 1 and make sure that your field then displays "1".
Also make sure the Resolution Date field is correctly set on your JIRA issue.
Make sure the custom field is added to the View ISsue screen, and then look at the field value in the issue screen (the issue navigator is based on the Index, which will need to be rebuilt once your formula works).
The second formula above works for me, as I am calculating the total time between a ticket Created and Resolved. However, it looks like it gets returned as an integer. Is there any any way to return as a decimal (for example, a ticket under 24 hours is all getting returned as "0" )
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.Read more
Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs