Problem in using Script Fields (Script runner plugin)

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
Accepted answer

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.

Hi,

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

Your script should look something like:

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

and your template

$!value

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

Hi,

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

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)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 29, 2018 in Marketplace Apps

How to set up an incident workflow from the VP of Engineering at Sentry

Hey Atlassian community, I help lead engineering at Sentry, an open-source error-tracking and monitoring tool that integrates with Jira. We started using Jira Software Cloud internally last year, a...

1,134 views 0 8
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you