Script runner help for scripting about field values

I realize I really dont understand the documentation about JIRA Script runner because there is absolutely no example of what I'm looking for. Could you help me ?

I'm looking for 2 scripts.

  1. Change the priority of an issue by detecting the a word in the description. I don't know how to get the description and how to do a contains search. I would like to change the priority to urgent when the description contains the "urgent" word.
  2. Copy the story points value to the original estimate. I would like to copy story points to days with a velocity factor. Velocity can be hardcoded for this first version. Each point is a day * velocity.

Thank you.


2 answers

This widget could not be displayed.


Story points is a custom field. You can access it like this:


import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.MutableIssue;
CustomFieldManager customFieldManager = ComponentManager.getInstance().getCustomFieldManager();
CustomField customField_name = customFieldManager.getCustomFieldObjectByName( "customfield_name" );
customfield_value = issue.getCustomFieldValue( customField_name))
The original estimate can be set like this:
issue.setEstimate(Long estimate)  //estimate should be given in seconds
This widget could not be displayed.

I finally found hoe to set the priority


import com.atlassian.jira.issue.MutableIssueif (issue.summary.contains("Urgent") || issue.summary.contains("URGENT")) {    MutableIssue mutableIssue = (MutableIssue) issue;    mutableIssue.setPriorityId("2");}

I'm sill looking for my point two.

I hate people that downvote without explanation. Then what? Doesn't help at all.

I know, especially when someone fixes their own problem.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published Jul 25, 2018 in Marketplace Apps

Jira Cloud and Bitbucket Cloud Integration with Microsoft Teams

One of the newest products in the Microsoft family - Microsoft Teams,  is a chat-based hub for teamwork that integrates all the people, content, and tools your team needs to be more engaged and ...

734 views 0 3
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