Forums

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

Get value of custom script field is always 0

Manuel Hoffmann
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 16, 2020

Hi at all,

in our company we use JIRA Server 8.5.1. I have two questions and hopefully someone could help. We have the Scriptrunner in use to calculate some more detailed values, .e.g. for the functional progress.

First:

I have already used the following line to retrieve a value of a custom scripted field (number field) and it is working:

def customFieldValue = ComponentAccessor.customFieldManager.getCustomFieldObject("customfield_YYYYY").getValue(issue)

Now we needed another custom scripted field which also needs the value from another scripted field. This field is visible on the belonging issue, it has a value different from 0. I can also access this value from the script console. But when I use the exactly same code within the script for the scripted field, it always says that the field's value is 0.

We are completely lost here, as I wrote before, exactly the same code works in multiple other scripted fields. Do you have any ideas? The only thing we could image is that the other scripted fields are limited to four specific projects and the newly created scripted field is global. Could that be the reason?

Second:

When I use logging in a scripted field by invoking log.debug and then pressing the preview button, no log shows up even when I use log.setLevel(Level.DEBUG) before. In other scripted fields I bypassed this by using my own logger: logger=Logger.getLogger("com.company.controlling.newValue") Now I tried it this way as usual and it is not working. The funny thing is that when I use a name for the logger which is already in use for another scripted field, e.g. logger=Logger.getLogger("com.company.controlling.oldValue") the logging works by pressing the preview button.

It would be really helpful if someone could provide help, especially for the first question.

Thanks,

Manuel

1 answer

Suggest an answer

Log in or Sign up to answer
2 votes
Adrien Low _ServiceRocket_
Community Champion
December 24, 2021

Hey @Eimy Jimenez ,

If you have the Send a custom email [ScriptRunner] post-function configured, below is a sample script that you can put into the Email template field:-

Dear ${issue.reporter?.displayName}, <br><br>

This issue has been transitioned to ${issue.status.name}.

View the issue <a href="http://localhost:8080/browse/${issue.key}">here</a>. <br><br>

Regards.

The output would be something like this:-

sampleOutput.png

Regards.

TAGS
AUG Leaders

Atlassian Community Events