Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Script to auto assign issues based on a specific word in the summary.

Aravindi Amarasinghe
Contributor
March 8, 2018

Hi All,

I have this requirement to auto assign issue to the reporter based on a Specific word (say "ABC") in the summary. I couldn't find any good way to to that in the community.

Can somebody help me with a script or a link to a possible solution?

Thanks in advance.

1 answer

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 16, 2018

If this is a Jira Service Desk project, you could do this using Automation.

But if this is not a service Desk specific project, Jira does not have a native way to do this.   But you could use a 3rd party plugin to allow for more extensive configuration abilities.  For example, the Automation for Jira plugin could help with this same kind of functionality that exists in the service desk projects.

There are probably other plugins that can also do this like Scriptrunner, or Power scripts, but these would require you to create a custom script for those plugins to be able to handle this. 

Aravindi Amarasinghe
Contributor
March 18, 2018

Hi @Andy Heinzer

Thanks for the answer.

Yeah I am using script runner and I come up with this script. But it doesn't do the job and sitting there without throwing me an error. Can you please point me the problem in this script?

import com.atlassian.jira.issue.*;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.ComponentManager;

MutableIssue myIssue = issue;
String summary = issue.getSummary();

String[] result = myIssue.summary.toString();


if (result!=null && result.length>3)
{

//Capture the word in summary

if (myIssue.summary.toString().matches("#RACF#"))
{

//Assign issue to the user

def user = userManager.getUserObject("au.aaa@bbb.com");
if (user) myIssue.setAssignee(user);
}
}
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 19, 2018

Sorry @Aravindi Amarasinghe

I am not well versed in the syntax of using scriptrunner scripts.   However I have tagged this thread with the Adaptavist and scriptrunner tags, so now this thread can appear inside those collections of community.  Perhaps this way an expert in regards to this kind of scripting might be better able to offer insights here.

Aravindi Amarasinghe
Contributor
March 19, 2018

Hi @Andy Heinzer

Thanks for the help. Hope they will help me with the script.  :)

hagarroud
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 10, 2020

Hi @Aravindi Amarasinghe 

Did you find the problem and the solution of the script?

Suggest an answer

Log in or Sign up to answer