Forums

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

how Attach file to the subtask during creation?

assia abde April 5, 2012

I use the SIL programe(JJUPIN plugin) to create a sub task, and I want to attach a file to the subtask
except that when I attach a file during the creation of the sub task, this file is attached to the parent issue, not to a sub task

in the button have the code below :

string #{modifrmd} = createIssue("RMDI", #{key}, "Modification REMDOC", "Demande de modification  de la REMDOC "+ #{key});

I use a creation screen of a subtask, which contains attachment boxes

how can i attach the file to the subtask??

thanks

4 answers

1 accepted

0 votes
Answer accepted
Ligia Merciu
Contributor
July 5, 2012

Hello Assia,

You have to add in the context file (C:\jira\JIRA-Enterprise-4.3.4\conf\context.xml for me) JIRA datebase as a resource:

<Resource name="jdbc/JiraDS"

auth="Container"

type="javax.sql.DataSource"

username="sa"

password=""

driverClassName="org.hsqldb.jdbcDriver"

url="jdbc:hsqldb:${catalina.home}/database/jiradb"

/>

if you use JIRA native database or something of this kind:

<Resource name="SqlServerTestDB"

auth="Container"

type="javax.sql.DataSource"

username="sa"

password="sa"

driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"

url="jdbc:sqlserver://JIRACLAIMS;instanceName=SqlExpress;databaseName=TestJira"

/>

if you are using another.

I shall write the code for the first case and notice the only difference is the database name for the other case:

string sk;

string old_path1;

string new_path1;

string path2;

string old_flName;

string new_flName;

string strSQL;

string delSQL;

sk=createIssue("TST", key, "test sub-task", "subtask with attachment" );

strSQL="select id, filename from fileattachment where issueid="+id+" order by id desc";

old_flName=getElement(sql("jdbc/JiraDS", strSQL),0);

new_flName=getElement(sql("jdbc/JiraDS", strSQL),1);

old_path1="C:/jira/home/data/attachments/"+project+"/"+key+"/"+old_flName;

new_path1="C:/jira/home/data/attachments/"+project+"/"+key+"/"+new_flName;

if (isNotNull(sk))

{

fileCopy(old_path1, new_path1);

attachFile(new_path1, sk);

deleteFile(old_path1);

deleteFile(new_path1);

delSQL="delete from fileattachment where issueid="+id+" and id="+old_flName;

sql("jdbc/JiraDS",delSQL);

}

I already tested it with JJUPIN 1.4.7 for JIRA 4.3.4 and it worked OK.

0 votes
assia abde October 9, 2012

I avoided directly modify the database

that's why I used a vbs script and windows to retrieve the last attached file, then attach it to the subtask

0 votes
Florin Manaila
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.
July 5, 2012

Hi,

Was the problem solved? What version of Jira are you using?

0 votes
assia abde April 8, 2012

do you need more informations?

please help me it's urgent :'(

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events