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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Automate Issue Creation from one JIRA instance to another JIRA instance

This is mostly configured when you're using a JIRA Server instance, but you can also do it with JIRA Cloud.

Configure locally two instances (one JIRA Software and other JIRA Service Desk) in order to configure rules to work with this.

It was possible to do that by configuring rules on Automation for JIRA on both instances. So these are the requirements for this to work:

  • Automation for JIRA must be installed on both instances, the one which is sending the webhook with the JIRA issue that was created and the one which is receiving the webhook with the JIRA issue.
  • You must have created the project on JIRA Software instance in order to receive the issues created dynamically.
  • You'll need to create two rules, one rule into the "sending webhook" instance and other rule into the "receiving webhook" instance.

Let me jump into the rules I've configured in order to make it work:

Rule for JIRA Service Desk instance:

image.png

 

This rule will be responsible for sending the webhook onto the JIRA Software instance. Follow the description of each field on "Send web request" action:

  • Webhook URL: This URL is retrieved when creating the rule on JIRA Software instance. Please check on the description under the "Rule for JIRA Software instance" section.
  • Headers (optional): You must insert the same headers as on the screenshot ("Content-Type" and "application/json") in order for this to work correctly.
  • HTTP method: It is POST because you're sending information towards the webhook URL.
  • Webhook body: Select "Issue data" just to make things simpler and so you'll be sending all the issue data.

 

Rule for JIRA Software instance:
Screenshot 1:
image.png

Screenshot 2:
image.png

This rule will be responsible for receiving the webhook from the JIRA Service Desk instance. Follow the description of each field on both Screenshot 1 and Screenshot 2.

Fields on Screenshot 1:
  • Webhook URL: This is the URL that we'll need to use on the "Webhook URL" field of the previous rule in order to direct the data towards this application. Copy and paste it carefully on the first rule.
  • Execute this automation rule with:: Select "Issues provided by webhook HTTP POST body" as we are sending the issues directly through the POST body;
Fields on Screenshot 2:
  • Project: Here you'll need to select the project under your JIRA Software instance that must receive all the issues that will be created from the JIRA Service Desk issues;
  • Issue Type: Here you must select the issue type that the issue will be created on. In case you need to create issues from different issue types, it is possible to add some conditions with "If block condition" and make separate "Create Issue" actions for each of the issue types.
  • Summary and Description: Here we must use a "Smart value" that works as a way of retrieving data that came from the "Webhook data". The logic for this specific scenario is that the "webhookData" object contains the "fields" object in which all the fields are inside. So, for the summary I've used {{webhookData.fields.summary}} and for the description I've used {{webhookData.fields.description}}. You'll need to add all the fields you want under the "Choose fields to set" option and then use the same logic to get the field values from the webhookData object.

Tips for implementation:

  • In order to gather the Webhook URL, start both rules creation at the same time, so you can easily copy and paste the value;
  • Start implementing this with only summary and description fields and then you can improve by searching for the fields one-by-one;
  • I've added a "Log action" action on the rule for JIRA Software instance in order to understand what was inside of the "webhookData" smart value, so I was able of figuring out the pattern that we need to follow to retrieve the fields as we wanted.

18 comments

Taranjeet Singh Community Leader Jul 30, 2020

@Victor Seger  Thanks for sharing this nice automation tip.

Like Victor Seger likes this

@Victor Seger 

Thanks for sharing, this helped me a lot!  I have a question about linking between Jira Cloud instances.

When a manager requests an Onboard, Offboard or Transfer in our HR Instance, I have a rule that creates an IT Task in the HR instance.  A web hook posts the IT Task details to our IT Instance and creates a new request (Request Type=HR Request).  How do I link the IT Task in HR to the HR Request in IT?

Once linked, I also need to update the IT Task in HR to Resolved when the HR Request in IT is Resolved.

Any guidance you can provide would be greatly appreciated!

Thank you!

Carla

Like Victor Seger likes this

@Victor Seger  Automation is just what we need, Thanks. But we have a problem with Incoming Webhook. The audit log says "No issues from the webhook". Can you help with that?

Like Victor Seger likes this
Victor Seger Atlassian Team Jan 07, 2021

@cfranke @Salome Khaindrava , We can help you both on that.

Can you please open a ticket on support.atlassian.com? 

By opening a ticket we can give you a closer support experience and try to help you properly.

@Victor Seger I did open a ticket, they helped with workarounds, but we could not get status updates to transfer back to the original system though I was told that a solution would be deployed by the end of 2020, but I do not know if that has happened or not.

Like Victor Seger likes this

@Victor Seger  Thanks, we figured it out. We had to choose the "No issues from the webhook" option for it to work. We will continue research and then open a ticket if it will be necessary.

Like Victor Seger likes this

Hello there, kindly show your ideas to proper format the url so I can send custom data: 

issues[]=TEST-1&data[BT24]=13456 

then when using {{webhookData}}, 13456 is not read 

Like Victor Seger likes this

@Victor Seger Your method worked for me to create an issue in a different Jira Cloud instance than the trigger issue. The only thing I had to change was choose No issues from the webhook option but I was still able to transfer issue data from the trigger issue to the created issue on the other cloud instance. 

Separately, I linked the two cloud instances together through Application Links and I am now able to manually link Jira issues to each other from different instances. I am wondering if you have a solution to automatically create that link. I have the URL and key from the target instance but there is no option to use smart values in Automation for Jira to create that cross-instance link. Nor can I find a way to do this through post-functions.

Thank you for posting this article!

Like # people like this

Hi @Victor Seger,

Is it possible to use a similar rule to update existing issues on the remote instance?

Thanks in advance!

Pablo

Victor Seger Atlassian Team Jun 14, 2021

@Pablo Serra , it should probably work! You'll only need to change some of its components in order to have them updating issues instead of creating them.

I'll also add that you might need to do some local testing as I didn't tested this yet.

Just to let everyone know, 8 months later I do not have a resolution on this. I can get the issue in the 2nd instance created, but there is still no way to update the trigger issue in the first instance when the issue in the 2nd has been resolved.

The instance I built has gone unused as a result of that and other internal factors.

You can update the trigger issue if you send over the original key and store it in the second instance's issue in a custom field when you create the issue in the second instance. I have successfully tested a separate web hook automation that updates the original issue from the second issue, using the key. 

Like # people like this

@Lenny Tabakman 

The workaround that Atlassian employed to create the issue in the other instance will not send over the key.  It would have worked if both projects are on the same instance, but it didn't work when creating in a separate instance.  They might have deployed updates in the past 8 months since so that it works, but it didn't back then, and like I said the team for which I built the instance never deployed it.  I'll definitely look into it if that project ever gets back off the ground.

@Lenny Tabakman I'm interested in the rule you've mentioned earlier, could you give me some details on how to set it up? Thanks! Pablo

I set the Webhook body option to Issue data on my Send web request action. Then on the Incoming Webhook automation on my receiving instance, I saved the key of the trigger issue by using smart value: {{webhookData.key}} into a text custom field. Then you can configure another automation which sends a webhook back to the original instance with the issue data included and use the custom field smart value with JQL to operate on the original trigger issue, like "key = {{webhookData.fields.customfield_12471}}"

Like Pablo Serra likes this

@Lenny Tabakman - I'm interested also in what you've done. I'm using Jira DC and Jira Cloud, and have automation set up to send a webhook from DC to Cloud to create an issue on a certain trigger. I'd love to be able to automate setting up the linking automatically, but haven't worked out how. Do you know if its possible using the custom field solution you used to update your original Jira issue? Thanks!

@Darren Weake I have not found anything for automating the creation of the link between two issues in different instances. I have just chosen to display the URL in a custom field and manually create the link.

Comment

Log in or Sign up to comment
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you