How to auto-assign issue using mapping

Hi there,

Perhaps I miss something but haven't found solution so far...

we need to automatically auto-assign issue right after its creation to a dynamically chosen user on the base of reporter.

To choose the assignee some mapping is needed. Every reporter has some default assignee independently in which project/component issue is created.

For example

User1 -> Assignee1

User2 -> Assignee1

User3 -> Assignee2

User4 -> Assignee2

User5 -> Assignee3

and so on...

Perhaps it could be done on the base of user properties but I have no clear idea or solution to this problem. Could you please help me? :)

thanks!

2 answers

1 vote
Henning Tietgens Community Champion Mar 05, 2013

You can use the Script Runner plugin to script a postfunction, where you map the reporter to the assignee.

we came back to the subject after a while and one more condition appeared... we need to get some hints for determining default assignee using external oracle datasource... i haven't found a solution on how to access external DB using script runner so far... any help would be appreciated :)

Henning Tietgens Community Champion Apr 02, 2013

Using something like this you can access an external database:

Sql sql = null

try {
	// Get Context to connect to DATABASE as a datasource
	Context ctx = new InitialContext()
	if (ctx == null) throw new Exception("No Context found!")
	DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/DATABASE")
	if (ds != null) {
		sql = new Sql(ds)
		sql.eachRow(sqlStatement) { row ->
			// ...
		}
	}
} catch (Exception e) {
	e.printStackTrace();
}
sql?.close()

The datasource DATABASE has to be defined within <Context> section of context.xml in jira/conf similar to something like this:

&lt;Resource name="jdbc/DATABASE" auth="Container" type="javax.sql.DataSource"
username="user"
password="password"
driverClassName="net.sourceforge.jtds.jdbc.Driver"
url="jdbc:jtds:sqlserver://10.192.168.1:1433/test"
/&gt;

After changing context.xml you have to restart JIRA. And you have to use driver matching the database system used.

Henning

using post function you can do this

but i need to script it somehow right?

no, just you need to configure postfunction at create transition step

ok this step is simple... but how can i freele choose assignee on the base of different reporters there? it'c completely customized behavior. i don't want to choose assignee from the list, because it depends on reporter - as i wrote in teh first post.

develop your own custmized postfunction, then add condition based on reporter and assign to the default assignee of the reporter

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Sunday in Agility

You asked for it, so we delivered: images on issues have arrived

A picture tells a thousand words. And agility boards have just released their latest feature: cover images on issues – so now your board can tell a story at first glance. Upload attachmen...

629 views 3 11
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