Raw XML Module Breaking Change for Jira 10
Understand the raw XML format changes for condition and provider class scripts introduced in Jira 10.0 and how to update your configuration.
The formats previously generated from the Preview button for each of these built-in fragment scripts are no longer valid:
If you previously created a fragment using the raw XML generated from the Preview button, you will have to manually update it to the new format for your fragment to function correctly. On this page, find the following information about this breaking change:
- Examples of the old Raw XML format
- Find the broken raw XML fragments
- Fix the broken raw XML fragments
- Fix a broken raw XML fragment for a web item provider
Fragment XML conditions and web panel class scripts are now provided via XML parameters and are no longer directly set as the condition class element attribute or web panel class element attribute value. You can use this guide to help you convert your scripts to the new fragment XML parameters format.
Examples of the old Raw XML format
Below are examples of raw XML scripts that will no longer work and will need updating.
Web Items
Inline script:
<web-item key='test-key' name='ScriptRunner generated web item - test-key' section='system.top.navigation.bar' weight='1'>
<label>Test</label>
<condition class='script:def myVar = 123 true'>
<param name='£trackingParameters' value='{"scriptName":"com.onresolve.scriptrunner.canned.jira.fragments.CustomWebItem"}' />
<param name='£fragmentParameters' value='{"id":"37b363fb-5d35-496f-9a7f-459621740bb7"}' />
</condition>
<styleClass> test-key </styleClass>
<link linkId='test-key'>https://www.google.com?_=1</link>
</web-item>Script file:
<web-item key='test-key' name='ScriptRunner generated web item - test-key' section='system.top.navigation.bar' weight='1'>
<label>Test</label>
<condition class='myConditions/fooCondition.groovy'>
<param name='£trackingParameters' value='{"scriptName":"com.onresolve.scriptrunner.canned.jira.fragments.CustomWebItem"}' />
<param name='£fragmentParameters' value='{"id":"37b363fb-5d35-496f-9a7f-459621740bb7"}' />
</condition>
<styleClass> test-key </styleClass>
<link linkId='test-key'>https://www.google.com?_=1</link>
</web-item>Web Panels
Inline script:
<web-panel key='test-one' name='ScriptRunner generated web panel - test-one' location='atl.header' weight='1' class='script:writer.write("My web panel HTML content")'>
<label>Test Panel</label>
<condition class='script:true'>
<param name='£trackingParameters' value='{"scriptName":"com.onresolve.scriptrunner.canned.jira.fragments.CustomWebPanel"}' />
<param name='£fragmentParameters' value='{"id":"9c79e82f-aba8-41c0-8ff7-1a6c147e8f1e"}' />
</condition>
<param name='lazy' value='true' />
</web-panel>Script file:
<web-panel key='test-one' name='ScriptRunner generated web panel - test-one' location='atl.header' weight='1' class='myPanels/myPanelScript.groovy'>
<label>Test Panel</label>
<condition class='myConditions/fooCondition.groovy'>
<param name='£trackingParameters' value='{"scriptName":"com.onresolve.scriptrunner.canned.jira.fragments.CustomWebPanel"}' />
<param name='£fragmentParameters' value='{"id":"9c79e82f-aba8-41c0-8ff7-1a6c147e8f1e"}' />
</condition>
<param name='lazy' value='true' />
</web-panel>Web Item Provider
<web-item-provider key='test-key' name='ScriptRunner generated web item provider - test-key' section='find_link/active-issues' class='script:import com.atlassian.plugin.web.api.model.WebFragmentBuilder ["Foo", "Bar"].collect { new WebFragmentBuilder(50). id("sample-web-item-${it.toLowerCase()}"). label("$it Sample Web Item"). title("$it Sample Web Item Title"). styleClass(""). webItem(""). url("/"). build() }' />Find the broken raw XML fragments
After you upgrade ScriptRunner for Jira and you still have the outdated raw XML fragments, ScriptRunner for Jira shows errors in the logs when ScriptRunner is enabled. Each error starts with this message:
Execution of Fragment script failed with errorThen the error message describes why it failed and gives a link to where you can edit the failing fragment.
Edit the broken fragment here: <URL Link to edit the broken fragment>The broken raw XML fragments will still show as active in the ScriptRunner UI fragments page, but they will not be functional.
Fix the broken raw XML fragments
Use the log output to find which raw XML fragments need to be fixed. Every time you edit or create a fragment, all fragments are re-registered, so you will see the log error messages every time you make changes until all invalid fragments have been fixed.
We suggest these steps to fix broken raw XML fragments:
Before you start updating XML, we suggest backing up the previous raw XML so that you can refer back to it if you are unable to get the new format working in the same way. This will help ScriptRunner Support if you need help creating the new raw XML format.
See below for detailed examples for each type of UI fragment.
Example: Fix a broken raw XML fragment in a web item
Let's say that you have the following web item script in your instances with the broken raw XML format:
<web-item key='test-key' name='ScriptRunner generated web item - test-key' section='system.top.navigation.bar' weight='1'>
<label>Test</label>
<condition class='script:def myVar = 123 true'>
<param name='£trackingParameters' value='{"scriptName":"com.onresolve.scriptrunner.canned.jira.fragments.CustomWebItem"}' />
<param name='£fragmentParameters' value='{"id":"37b363fb-5d35-496f-9a7f-459621740bb7"}' />
</condition>
<styleClass> test-key </styleClass>
<link linkId='test-key'>https://www.google.com?_=1</link>
</web-item>Follow these steps to fix it:
Example: Fix a broken raw XML fragment in a web section
The process for migrating web sections is the same as for web items. Follow these steps:
- Fill out the Create a Custom web section form, referring to the old broken raw XML for the form field values.
- Click the Preview button to get the new XML.
- Add the missing extra elements shown in Add the missing extra elements in the web item steps above.
- Add the condition back to the XML (remember to use the converter script to convert your inline scripts to the new format):
Example: Fix a broken raw XML fragment in a web panel
Let's say that you have the following web panel script in your instances with the broken raw XML format:
<web-panel key='test-one' name='ScriptRunner generated web panel - test-one' location='atl.header' weight='1' class='script:writer.write("My web panel HTML content")'>
<label>Test Panel</label>
<condition class='script:true'>
<param name='£trackingParameters' value='{"scriptName":"com.onresolve.scriptrunner.canned.jira.fragments.CustomWebPanel"}' />
<param name='£fragmentParameters' value='{"id":"9c79e82f-aba8-41c0-8ff7-1a6c147e8f1e"}' />
</condition>
<param name='lazy' value='true' />
</web-panel>The process for migrating a web panel's raw XML is the same as for web items when migrating the conditions element, but also requires one extra step to migrate the web panel provider class.
Follow these additional steps to migrate the provider class script:
Example: Fix a broken raw XML fragment for a web item provider
When migrating an old Raw XML configuration for a Custom Web Item provider to the new format, you have to move the web-item-provider class attribute value to the new providerClassConfig param. For example:
Let's say this is an old Raw XML configuration similar to the below:
<web-item-provider key='test-key' name='ScriptRunner generated web item provider - test-key' section='find_link/active-issues' class='script:import com.atlassian.plugin.web.api.model.WebFragmentBuilder ["Foo", "Bar"].collect { new WebFragmentBuilder(50). id("sample-web-item-${it.toLowerCase()}"). label("$it Sample Web Item"). title("$it Sample Web Item Title"). styleClass(""). webItem(""). url("/"). build() }' />To convert the above:
Use the following as your template for the new raw XML template:
<web-item-provider key='test-key' name='ScriptRunner generated web item provider - test-key' section='find_link/active-issues' class='com.onresolve.scriptrunner.fragments.ScriptWebItemProvider'>
<param name='providerClassConfig'><![CDATA[{"parameters":{},"script":"PUT THE CONVERTED SCRIPT IN HERE","scriptPath":null}]]></param>
</web-item-provider>If the value for your old XML class attribute starts with "script:" :
- Find the key attribute in your old raw XML and use the same value for the same attribute in the above new raw XML template.
- Find the section attribute in your old raw XML and use the same value for the same attribute in the above new raw XML template.
- Take the class attribute value. e.g. the 'script:the script content' part in for example class='script:the script content'
If the value for your old XML class attribute is a path to a file; For example: class='path/to/my/groovy/file.groovy'
- Open the Web Item Provider built-in script form.
- Fill out the form details.
- Name: Take the name value text from the old XML
- What section should this go in: Take the section value from the old XML
- Key: Take the
keyvalue from the XML. e.g:test-key
- Click the File tab on the Provider class/script field and add your old file path as the value.
- Click Preview to generate the new Raw XML format that can be used to define a web item provider as a raw XML configuration.