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
qaroleid variables are have not the same type, you should get an error like this:
qaroleid, which received a
java.lang.Long value from the
jelly.role.id 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
jelly.role.id 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: