How to auto-assign issue using mapping

BartłomiejS March 5, 2013

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
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.
March 5, 2013

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

BartłomiejS April 1, 2013

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
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.
April 2, 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

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.
April 3, 2013

good info on using a datasource, alternative method is here: https://answers.atlassian.com/questions/154110/script-runner-external-oracle-database-support

0 votes
RambanamP
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.
March 5, 2013

using post function you can do this

BartłomiejS March 5, 2013

but i need to script it somehow right?

RambanamP
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.
March 5, 2013

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

BartłomiejS March 5, 2013

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.

RambanamP
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.
March 5, 2013

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