Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to create an issue in a remote jira instance using a workflow transition?

Fabian Meier
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.
May 16, 2012

I am trying to escalate a support ticket from one JIRA instance into another one. That basically means creating the issue in another JIRA instance and copy some values. Afterwards both tickets will co-exist.

I already did some research and it seems to be a lot more complicated than I originally anticipated, especially because I have to somehow link the issues two together (a http link in a custom field would do for now). I had a look at the following options, but I am still unsure which way to go:

* JIRA 2 JIRA Copy Issue plugin (looks promissing, but no automated/post function solution)

* Send Issue via Email (e.g. using JETI plugin) in combination with a custom email handler (e.g. EZGroovey or JEMH) - Looks doable, but probably not easy to link issues together

* SOAP API (I guess running a custom script in JIRA A to create issue in JIRA B) - Seems to be the best solution, but (a) a lot of effort/complicated, (b) will be replaced by REST API

* REST API (not available on JIRA 4.x)

* JIRA CLI - Not sure how this would work.

* JJUPIN () - Adds a whole new layer of scripting, is paid and a bit overkill for a single usecase

I really appreciate any thoughts / help, especially if I missed something =)

8 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Radu Dumitriu
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.
May 16, 2012

It's funny, someone just asked us to prove that creating an issue from some server to the other works.

Calling script in JJupin should look like (not really tested, but it will give you an idea):

=======

string[]arrp;

string [] ret;

arrp=addElement(arrp, summary);
arrp=addElement(arrp, priority);
arrp=addElement(arrp, description);
arrp=addElement(arrp, assignee);
arrp=addElement(arrp, reporter);
arrp=addElement(arrp,project);
arrp=addElement(arrp,key);
arrp=addElement(arrp, issueType);

//remote.dir and remote.url.base should be defined in sil.properties. The remote system should be configured.
ret=call("remote", silEnv("remote.dir") + "CreateReplicatedIssue.sil",arrp);

//place here the URL in the local issue http://destserver:port/jira/browse/TSTPRJ-123
customfield_10251=silEnv("remote.url.base")+getElement(ret, 0);

=======

In the CreateReplicatedIssue.sil one may write, on the destination server:

=======


string s=getElement(argv,0);
string p=getElement(argv,1);
string d=getElement(argv,2);
string a=getElement(argv,3);
string r=getElement(argv,4);
string pj=getElement(argv,5);
string ini_k=getElement(argv,6);
string itype=getElement(argv,7);

//use the simplest create routine (there are overloads, but let's demonstrate the language)
string k=createIssue("TSTPRJ", "", itype, s);
%k%.priority = p;
%k%.description = d;
%k%.assignee=a;
%k%.reporter=r;
%k%.customfield_10000=ini_k; //the key
%k%.customfield_10001=silEnv("origin.browse.base")+ini_k; // creates the URL like http://originserver:port/jira/browse/IMJ-334

return k;

=======

Overkill ? :)) Try any other solution. You will end up writing at least twice as much code. When you will upgrade Jira, you will need to upgrade other scripts, code, etc. That's exactly why we created it, it remains unchanged between subsequent Jira versions.

Fabian Meier
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.
May 16, 2012

Well, I have to install the plugin on both systems, pay for it, and spend some time to play with it - all for the single purpose of solving this single operation. Don't get me wrong, I will definitely look into it if I am not satisfied with the alternatives =)

I am just wondering that I cannot find any e.g. SOAP solution that already works. It should be trivial to make it work for another JIRA installation...

Radu Dumitriu
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.
May 16, 2012

You do not need to pay while you play. We trust our customers. You can generate as many temporary licenses as you want.

Fabian Meier
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.
May 27, 2012

While initially being sceptical about this approach I still tried it and it turns out to do exactly what I need to do. I had some trouble getting the remote system calls working but after all it looks very promissing! Solution accepted! =)

Chuck Vanderwist November 30, 2012

Radu - any advice on troubleshooting the scripts if they don't create the new issue as expected? Which logs? what to look for... etc?

2 votes
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.
May 16, 2012

Personally I would write a few lines of groovy to call the jira remote copy plugin... but horses of courses. You've listed all the options, probably what will work for you is the programming language you're most familiar with.

Fabian Meier
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.
May 21, 2012

I am not very familiar with how this would work, could you give me an example that would get my onto the right track? How can I call the script, can I use ScriptRunner? How can I call the jira remote copy plugin?

phoebeliu November 21, 2013

Hi Jamie,

Coul you share the script of how to call the remote copy plugin?

That would be very helpful.

Thanks.

1 vote
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 16, 2012

I can't really give you an answer but there is some stuff to think about:

I'd avoid SOAP, because it's being effectively deprecated in favour of REST

Jira 4.x does support REST, but obviously the API is less evolved than later versions

The Jira CLI is what it says on the tin - a command line interface. It uses the remote APIs linke anything else you might end up writing, but simplifies the structure so that you can issue simple commands in (manually, or scripted) instead of having to write the code by hand. (e.g. link two issues is 8 lines of java in my last piece of external-to-Jira work, and 1 command on the CLI)

Atlassian are looking at tighter links between separate Jira installations, so I'd do your simple http linking for now, and not rush to develop anything more complex.

Fabian Meier
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.
May 16, 2012

Yeah, I second your thoughts about SOAP. I could not find a solution for my usecase and developing it from the scratch takes too much effort.

Very interesting that you mention REST for JIRA 4.x since I was so sure that they introduced that in version 5.x. Maybe I will do a 80:20 approach and see what I can do with the REST implementation in version 4.x and later add the missing features. I am not that familiar with how using REST works (yet). Does the JIRA version of the source or destination system matter? The destination system (for the new issue) will actually be upgraded to JIRA 5 very soon. Does that help?

Also, shouldn't there be some code SOAP snippet on the internets that does exactly what I want to do? How do you call it from a workflow transition?

I guess I only included CLI since I actually understood it right away and, since it allows remote access, were wondering if I could just call a batch file from a workflow transition. Thinking about it, it might be a bit of a workaround and generally speaking just a wrapper of SOAP / REST. (Don't get me wrong Bob Swift, if this works, I am more than willing to try! *g*)

0 votes

How about webhooks? 

0 votes
Bob Swift OSS (Bob Swift Atlassian Apps)
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.
August 28, 2012

Just to follow up on this for others: CLI Plugin for JIRA was released. How to create issues on a remote system is a specific use case.

0 votes
Bob Swift OSS (Bob Swift Atlassian Apps)
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 12, 2012

I have a plugin for doing things like this and need beta testers. Contact me if interested.

0 votes
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.
May 16, 2012

Personally I would write a few lines of groovy to call the jira remote copy plugin... but horses of courses. You've listed all the options, probably what will work for you is the programming language you're most familiar with.

0 votes
Bob Swift OSS (Bob Swift Atlassian Apps)
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.
May 16, 2012

I have a plugin planned for doing this, but it is many weeks away from being done. Contact me if you like.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events