Hi Team,
I am new to scriptrunner.
what is Difference between getValue() and getFormValue() in Scriptrunner, Behaviour?
Thanks.
Regards,
Saqib Dar
Community moderators have prevented the ability to post new answers.
getValue() gives you underlying objects from java, e.g. ArrayList<Option>
getFormValue() gives you the string representation of the values, e.g. [Apples, Oranges]
See the API help page: https://docs.adaptavist.com/sr4js/7.2.0/features/behaviours/api-quick-reference?utm_source=product-help
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Eh, I just checked the page I so gloriously linked, it's pretty unclear there but I still recall getting options from getValue() at some point.
In case you come across something you aren't quite sure of, I do something like this to "debug" the values in the description:
def description = getFieldById("description")
// whatever I am debugging, e.g.
def myField = getFieldById(getFieldChanged())
def myFieldValue = myField.getValue()
//now we can look what's inside
description.setFormValue(myFieldValue.toString() + " .. " + myFieldValue.class.getSimpleName())
//and in case of lists, like multi selects, components and whatnot
description.setFormValue(myFieldValue.class.getSimpleName() + "<" + myFieldValue?.first().class.getSimpleName() + ">")
I wrote this manually just now so I hope there's no typo, but this is the way how I was able to figure out what objects I'm working with, on a few occasions.
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.