Hi,
I am copying remaining estimate into another field during a workflow transition. However, the data that gets copied is in seconds. I would like to present it as hours in a calculated field. This is what I have so far:-
<!-- @@Formula:
if (issue.get("customfield_13315")==null)
return null;
return (issue.get("customfield_13315"))/3600;-->
This isn't returning any value to the field.
Please help :)
Thanks
James
Remaining time on an issue is not a custom field, so I suspect your "get" commands are not getting the right thing.
Unless you have defined a custom field for it, in which case, start with a look at the type of field it is. Numeric? Holds number of days, hours or minutes?
Hi,
I am copying remaining estimate into a number field and then trying to use a custom field to convert back into hours. I can get the time in seconds but when I try to convert it into hours, I get nothing. Its quite frustrating.
Thanks
James
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, I think it might be converting with the wrong variable types. Could you try these two lines as calculations and see what they do (on any issue that has a number in the seconds field)
return (issue.get("customfield_13315"));
return (issue.get("customfield_13315"))/1;
I know a divide by 1 looks a bit odd, but it's a test to see if it gives you an empty result instead of the same number you get from the other line, as it would show a conversion is going wrong!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Nic,
This line: return (issue.get("customfield_13315")); Returns 10,800 (The issue has 3H remaining).
This line: return (issue.get("customfield_13315"))/1; Returns nothing and as such the field is not visible on the form view.
Thanks
James
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, that is what I suspected then - the division is resulting in an output that does not work for loading the field. The /1 returning a failure is consistent with that!
My guess is that there's something like a type conversion going wrong - if for example the output of a division is a float, and Jira only (usually) works with doubles and longs.
I'm not sure how you'd fix that in this scripting language. If it were plain Java, a simple cast or explicit conversion would work fine, but I'm not sure about your scripting functionality
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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.