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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @PD Sheehan ,
I created an automation rule that composes raw xml as content of an e-mail as well as I can send the xml via webrequest. Is it possible to store the xml as well automatically in a local file? How to do so?
Best regards
Karin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Karin
I actually achieved it after input from Adaptavist and a web session Q&A.
This script will place a word document on the local machine Jira is running on.
It is running as part of a custom script post function
Hope this helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.