Not working with Scriptrunner Scripted Fields

Create issue
Issue #11 resolved
B. Normann P. Nielsen created an issue

If I use Numeric (Stats) Searcher on a Scripted Field that returns and Int:

long createdDateTime = issue.created.getTime() long updatedDateTime = issue.updated.getTime()

if (updatedDateTime) {

return (updatedDateTime-createdDateTime)/(10006060*24) as int } else

Indexing fails with:

2016-06-21 10:49:20,489 JiraTaskExectionThread-14 WARN npn 636x730005x2 1cvz4r0 77.243.49.62 /secure/admin/jira/IndexReIndex.jspa [c.a.j.issue.index.DefaultIssueDocumentFactory] Error indexing issue SALG-2447: Dropped: [customfield_15121, customfield_15122, customfield_15124, customfield_15134, customfield_15136, customfield_15421, customfield_15422]

Comments (6)

  1. B. Normann P. Nielsen reporter

    Complete Field Script:

    import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.IssueManager import com.atlassian.jira.issue.CustomFieldManager import com.atlassian.jira.issue.fields.CustomField import java.text.SimpleDateFormat

    long createdDateTime = issue.created.getTime() long updatedDateTime = issue.updated.getTime()

    if (updatedDateTime) {

    return (updatedDateTime-createdDateTime)/(10006060*24) as int } else

  2. B. Normann P. Nielsen reporter

    Hi, its customfield_15421 (actually, I think all fields are Scriptet fields with the Numeric (Stats) searcher.

    PS: Thanks for a good and usefull plugin - with an actually affordable price (thumbsup)

  3. B. Normann P. Nielsen reporter

    Regarding the KB issue, I see no log except:

    2016-06-21 12:36:08,628 Caesium-1-3 WARN anonymous Create/Comment Service - Support (Service Request) [c.a.j.issue.index.DefaultIssueDocumentFactory] Error indexing issue SUPPORT-14034: Dropping 'customfield_15122' 2016-06-21 12:36:08,629 Caesium-1-3 WARN anonymous Create/Comment Service - Support (Service Request) [c.a.j.issue.index.DefaultIssueDocumentFactory] Error indexing issue SUPPORT-14034: Dropping 'customfield_15134' 2016-06-21 12:36:08,629 Caesium-1-3 WARN anonymous Create/Comment Service - Support (Service Request) [c.a.j.issue.index.DefaultIssueDocumentFactory] Error indexing issue SUPPORT-14034: Dropped: [customfield_15121, customfield_15122, customfield_15124, customfield_15134, customfield_15136]

  4. Marc Trey repo owner

    Your script must return a Double

    here is your script :

    long updatedDateTime = issue.updated.getTime()
    if (updatedDateTime) {
        return Double.valueOf((updatedDateTime-issue.created.getTime())/(10006060*24) as int) 
    } else {
        return 0 as Double 
    }
    

    you need to perform a reindex after you change your scripted fields

  5. Log in to comment