Raw XML Module Built-In Script
All of the built-in scripts produce XML that is similar, but not interchangeable with, XML found in a plugin descriptor. You will notice that, for usability reasons, the forms do not provide all the possible configuration elements available in plugins. For example, the web item script does not allow you to provide a tooltip for the web item link, a velocity context provider, or an icon URL.
You can work around this limitation by using XML Module Item and following these steps:
Fill out the form and then click the Preview button to get the required XML from one of the other fragment scripts.
Do not click the Save/Update button.
Copy the XML into the Raw XML Module script.
Make modifications as required.
Example
Let's say we want to add a new button to the navigation bar. Enter the XML:
xml<web-item key='custom-web-item' name='ScriptRunner generated web item - custom-web-item' section='header.global.primary' weight='70'> <label>Google something</label> <link linkId='custom-web-item'>http://www.google.com</link> <tooltip>Click here to google something</tooltip> </web-item>
Verify the new button appears as:
Using Multiple Items
Another reason to use this built-in script is that it allows you to make multiple modifications that belong as a single unit in a single script, which you can enable and disable en bloc.
The XML below allows you to create the following structure, which consists of:
a drop-down menu in the top navigation bar
a web section activated by that menu item, which has a heading
two simple web items
This is produced by the following XML:
xml<web-item key='toppy' name='ScriptRunner generated web item - toppy' section='header.global.primary' weight='70'> <label>Toppy</label> <link linkId='toppy'></link> </web-item> <web-section key='top-menu-section' name='ScriptRunner generated web item - top-menu-section' location='toppy' weight='70'> <label>Subby</label> <param name='lazy' value='true' /> </web-section> <web-item key='x-other' name='ScriptRunner generated web item - x-other' section='toppy/top-menu-section' weight='1'> <label>Sub-menu item</label> <link linkId='x-other'>/</link> </web-item> <web-item key='y-other' name='ScriptRunner generated web item - y-other' section='toppy/top-menu-section' weight='1'> <label>Another menu item</label> <link linkId='y-other'>/</link> </web-item>
XML aficionados will note that the above XML is not technically correct as it does not have a root element, but in this case, a root element is automatically added for you.