Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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 a Jira Issue XML export - perhaps via a workflow transition

Hi

Would anyone have any suggestions on the best way to do this? I am attempting to replace a legacy ticketing system with Jira. The legacy system generated an XML per ticket that could be read by a media asset manager (MAM) and create a pre defined folder structure in the MAM based on the XML.

Could this be achieved in ScriptRunner during a workflow transition perhaps?

Thanks

Gordon

 

 

1 answer

1 accepted

0 votes
Answer accepted

I'm not familiar with the MAM or the XML structure, but sure... you could do that with scriptrunner.

As part of designing the code for this in the workflow post function, you would need to know all the Jira fields and custom fields that you want to map to the XML.

The best way to achieve that would be with the MarkupBuilder.

Something like this

import groovy.xml.MarkupBuilder
import com.atlassian.jira.component.ComponentAccessor
def customFields = ComponentAccessor.customFieldManager.getCustomFieldObjects(issue)
def writer = new StringWriter()
def xml = new MarkupBuilder(writer)
xml.mkp.xmlDeclaration(version:"1.0")
xml.root{
issuenode{
key{ xml.mkp.yield issue.key}
fields{
summary issue.summary
reporter issue.reporter.name
assignee issue.assignee.name
customFields.each{cf->
def val = cf.getValue(issue)
if(val){
"$cf.name"{xml.mkp.yield val}
}
}
}
}
}
writer.toString()

Will output an XML that looks like this

<?xml version='1.0'?> 
<root>
<issuenode>
<key>JSP-1922</key>
<fields>
<summary>blah blah</summary>
<reporter>xxx</reporter>
<assignee>xxx</assignee>
<My CustomField>the value</My CustomField>
<Another CF>value</Another CF>
<!-- etc for the rest of te custom fields -->
</fields>
</issuenode>
</root>

Obviously, you need to shape your code to output the right XML layout etc.

And then you need to decide what to do with that XML ... either store it to a local file or send it as an HTTP request to another system.

Hi Peter-Dave

Really appreciate your time and effort to suggest this answer! It will take me some time to test with a developer but will update you on progress.

Thanks again

Regards

Gordon

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
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