ScriptRunner scripted field; output is broken up incorrectly

Issue #13 resolved
Lacey McDonnell created an issue

So... I did a scripted age field and a scripted aging category field.

Obviously the Age field works like a charm - it's just a number. BUT. The scripted Aging Category is behaving the weirdest way on the Two Dimensional Stats chart.

I'm marking this as major purely because the EVP is down my throat about it. :)

I have it set as a Free Text Searcher (stats) with a Template of Text Field (multi-line) so those match.

Attached is a screen shot, below is the script.

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;

ComponentAccessor.getFieldManager().find{'Age'}
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
CustomField customField_name = customFieldManager.getCustomFieldObjectByName('Age');

def int value = (getCustomFieldValue('Age') as String)?.toInteger()

def finalResult() {
if ( (getCustomFieldValue('Age') as String)?.toInteger() < 30)
{return 'Less than 30'}
else if ((getCustomFieldValue('Age') as String)?.toInteger() <=60 && 16634 >=30)
{return '30-60'}
else if ((getCustomFieldValue('Age') as String)?.toInteger() <= 90 && (getCustomFieldValue('Age') as String)?.toInteger() >=60)
{return '60-90'}
else if ((getCustomFieldValue('Age') as String)?.toInteger() >90 && (getCustomFieldValue('Age') as String)?.toInteger() >=60 && (getCustomFieldValue('Age') as String)?.toInteger() >=30)
{return 'Greater than 90'}
}
def result = finalResult()

Comments (5)

  1. Lacey McDonnell reporter

    I tried both Free Text Searcher (stats) and Exact Text Searcher (stats) and both show the exact same results as the screenshot.

    There is no "Text Searcher (stats)"error1.PNG in the dropdown

  2. &(*&)#)_*#@@(*)(@*)(*@ repo owner

    you should reindex after changing the search template to the Exact Text Searcher

  3. Lacey McDonnell reporter

    :D Thanks. You must get so sick of people asking these questions before they re-index :)

  4. Log in to comment