Documentation for JIRA 4.4. Documentation for other versions of JIRA is available too.

Skip to end of metadata
Go to start of metadata


When programming in Jelly, you can get in a situation as illustrated by the following code snippet:

The goal here is to create a new Project Role and then set the appropriate Permissions to it. However, as the projectroleid and qaroleid variables are have not the same type, you should get an error like this:

So qaroleid, which received a java.lang.Long value from the context variable, should be converted to a java.lang.String type so it can be informed as projectroleid attribute when setting a Permission.


How can you convert types in Jelly?


You can use the invoke Jelly tag to call the method toString on the context variable and store this value the in the qaroleid variable. So you should replace this line...

... with this...

... and the script will work sucessfully.

You can also (just as an example matter) use the new Jelly tag to convert the java.lang.String value of the qaroleid variable into a java.lang.Float value and store it in the qafloatvar variable, as shown here:

You may find useful to look at these pages for more information on Jelly tags:

  • No labels