Hi,
I'm trying to convert a custom field of type "text field" into integer with the following approch:
<!-- @@Formula: Integer.parseInt(issue.get("customfield_10328")) -->
Then I got the following error message:
I'm using Jira V4.3.3 and jira-misc-custom-fields-1.1.2. I'm new in Jira and Javascript, so sorry if the question seems to be stupid... ;)
Thanks & regards,
Yunzhu
This is probably because your customfield_10328 can sometimes have a null value. So you should test against null values before converting to int:
issue.get("customfield_10328")==null ? 0 : Integer.parseInt(issue.get("customfield_10328"))
Thanks for your answer, i've already tried this but it dosen't work, so i used the simplest instruction to test. When i try the above code, i got this:
So is it means that i got a problem with my library or somthing like that?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nothing else on the screen except for "Method Invocation Integer.parseInt".
Finally I will abandon this idea, in fact we are not allowed to install any plugin in our Jira system... Thank you anyway for your help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just to answer the question then, what this is saying is that there exists no function called "parseInt" that accepts a double as its only parameter.
A few ways to get around this is to cast the Double to an Integer:
(Integer)(issue.get("customfield_10328"))
Or run toString() on the Double (make sure it's not null!) and then pass that to Integer.parseInt:
Integer.parseInt(issue.get("customfield_10328").toString())
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is there anything else following "Method Invocation..." left out of the screenshot?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try like this if the custom field type is text
Integer.parseInt((String)issue.get("customfield_10328"))
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.
I tried with a custom field of type integer and instead of "Method Invocation" I got the following error:
Finally I will abandon this idea, in fact we are not allowed to install any plugin in our Jira system... Thank you anyway for your help!
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.