Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Get value of Scripted Field - ScriptRunner

Daniel Alonso July 3, 2020

I'm trying to get a value of a custom field, but this CF is a Scripted Field, I try to get the value on the next way

log.debug('Starting...')
def assigneeManagerCF = customFieldManager.getCustomFieldObject("customfield_20083")
log.debug(assigneeManagerCF)
x = assigneeManagerCF.getValue(issue)
log.debug(x)
log.debug('End')

 And this is my output:

Starting...
Days in Triage
<NOTHING>

As mentioned, this is a Scripted Field, and it should show a number.

Any ideas?

 

1 answer

0 votes
Nic Brough -Adaptavist-
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.
July 3, 2020

Where is this code running?

Daniel Alonso July 6, 2020

Hi Nic,

It's running on server, I'm trying that code in Console.

Nic Brough -Adaptavist-
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.
July 6, 2020

How are you getting the issue object?  Are you sure that issue has a value for the custom field?

Also, your output bears no relation to the script, could we see the actual output?

Daniel Alonso July 6, 2020

Nic,

This is how I'm getting the object:

def assigneeManagerCF = customFieldManager.getCustomFieldObject("customfield_20083")
x = assigneeManagerCF.getValue(issue)

 And then trying to get the value with the variable 'x'.

I'm sure that the field has a value, after all the calculation the output is a number.

"Also, your output bears no relation to the script, could we see the actual output?"


I set it as <NOTHING> because that's the end of the output, even when I'm trying to debug an 'End' message, it is not being printed, so I think that the x = ... line is breaking the script but I don't understand why.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events