Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Difference between getValue() and getFormValue() in Scriptrunner. Behaviour

Saqib Dar
Contributor
October 31, 2022

Hi Team,
I am new to scriptrunner.
what is Difference between getValue() and getFormValue() in Scriptrunner, Behaviour?
Thanks.
Regards,
Saqib Dar

1 answer

1 accepted

2 votes
Answer accepted
Radek Dostál
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 31, 2022

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

Saqib Dar
Contributor
October 31, 2022

@Radek Dostál  thanks mate

Radek Dostál
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 1, 2022

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. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events