Problem in using Script Fields (Script runner plugin)

megha jayaswal January 14, 2014

Hi all,

I am very new to jira and has not even used scripts uptil now. I need to use the Script fields. i had installed it on jira, but I am facing problem in using it. to use thescript fields, I need to write a script and fill up this(shown in the picture). can anybody help me with this? what should be there in script file path, script, tempalte etc....

3 answers

1 accepted

3 votes
Answer accepted
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 14, 2014

I'm not sure what the confusion is.

You need to write a script that does what you want. (We can't start on that, as we don't know what you want). Once you've written it, you need to tell Jira how to get to it. Either upload it as a file and use the "script file path" to tell Jira where it is, OR you write it in the "Script" field.

The template, as per docs, is the text the field will output, using the results from the script.

megha jayaswal January 15, 2014

Hi,

I want script field to have the value "true" when assignee = reporter and "false" otherwise. can i have the script for this one?

DanielP
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.
January 15, 2014

Your script should look something like:

return (issue.getAssignee().getName().equals(issue.getReporter().getName()))

and your template

$!value

megha jayaswal January 16, 2014

hi,

I did the following and in the script testing for a issue it was returning the correct value. But the field was not working in the issue navigator. I tried reindexing then. jira was unable to reindex and was showing the error because of the scripted custom field i had created. I deleted the custom field and reindexed. when i created the field again then it was not even showing any value in the script testing for an issue. Tried reindexing and was showing the same error. is there any problem or incompatibility of the script field created on jira

0 votes
JamieA
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.
January 28, 2014

Daniel's script is broadly correct but doesn't take into account when there is no assignee, which is probably what is blowing up your indexing (NPE).

The script should just be:

issue.assignee == issue.reporter

However I would not waste a script field on this... you can use script runner's JQL functions to query on this, eg:

issuefunction in expression("", "assignee == reporter")

See https://jamieechlin.atlassian.net/wiki/display/GRV/Scripted+JQL+Functions#ScriptedJQLFunctions-expression(Subquery,expression)

0 votes
DanielP
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.
January 14, 2014

Hi,

Unless you explain what you want the field to do, we can't really help you.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events