You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hello,
i am trying to set a formfield using a behaviour.
The data i am trying to set is read from another issue.
When i try to set the field value like this
Issue presetFound = (Issue) issueIterator.next()
Customfield field = customfieldManager.getCustomFieldObject(11603L)
java.lang.Object fieldValue = presetFound.getCustomFieldValue(field)
if (fieldValue != null) {
com.onresolve.jira.groovy.user.FormField formField = getFieldById(field.getId())
errorMessage += "set field " + field.getId() + " to " + fieldValue.toString() + ", field is " + formField.getClass().toString()
formField.setFormValue(fieldValue)
}
When i comment out the last statement the errorMessage is
set field customfield_11700 to KLE-VE-4753 field is class com.onresolve.jira.groovy.user.FormField
When the statement is not uncommented the beheviour is not executed and this errror is logged:
2018-10-30 16:41:43,441 http-nio-8080-exec-79 ERROR admin 1001x12741x1 1s5x3j9 80.147.223.246,127.0.0.1 /rest/scriptrunner/behaviours/latest/runvalidator.json [c.a.p.r.c.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service: null
java.lang.StackOverflowError
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaBeanProperty.getProperty(MetaBeanProperty.java:62)
at groovy.lang.PropertyValue.getValue(PropertyValue.java:42)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.getProperties(DefaultGroovyMethods.java:389)
at groovy.json.JsonOutput.getObjectProperties(JsonOutput.java:327)
at groovy.json.JsonOutput.writeObject(JsonOutput.java:320)
See here for the Full Exception
your are add an Object to custom field and this cause the error. Please, could you verify what is the type of your custom field?
If it is a text, you need to add String as value, if it is a select list you need to add an Option and so on.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bryan,
i have nothing i can quickly paste for you, but the working version should be something like this (3rd line is the one with the change):
Issue presetFound = (Issue) issueIterator.next()
Customfield field = customfieldManager.getCustomFieldObject(11603L)
String fieldValue = (String) presetFound.getCustomFieldValue(field)
if (fieldValue != null) {
com.onresolve.jira.groovy.user.FormField formField = getFieldById(field.getId())
errorMessage += "set field " + field.getId() + " to " + fieldValue.toString() + ", field is " + formField.getClass().toString()
formField.setFormValue(fieldValue)
}
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.