Hi Team,
I am new to scriptrunner.
what is Difference between getValue() and getFormValue() in Scriptrunner, Behaviour?
Thanks.
Regards,
Saqib Dar
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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.