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 give you the option 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 by following these steps:

  1. Get the required XML from one of the other fragment scripts by filling out the form, then clicking the Preview button.

    Do not click the Save/Update button.

  2. Copy the XML into the Raw XML Module script.

  3. Make modifications as required.

Example

If you have created a link in the Browse Projects menu, and now you want to add a tooltip and icon to the web item, enter this XML:

                <web-item key='custom-web-item' name='ScriptRunner generated web item - custom-web-item' section='system.header/left' weight='70'>
                    <label>Google something</label>
                    <condition class='com.onresolve.scriptrunner.fragments.ConfluenceScriptRunnerCondition'>
                        <param name='conditionConfig'><![CDATA[{"parameters":{},"script":"context.getSpace() != null && context.getSpace().isPersonal()","scriptPath":null}]]></param>
                    </condition>
                    <link linkId='custom-web-item'>http://www.google.com</link>
                    <tooltip>Click here to google something</tooltip>
                </web-item>

Verify the menu item appears as:

Use Multiple Items

Using this script, you can make multiple modifications that are a single unit in a single script, which you can enable and disable at the same time.

Use the XML below to create the following structure:

  • A web section in the Administration dropdown menu

  • Two web items in the new web section

    • Contact Admin Team

    • Contact Support Team

This is produced by the following XML:

               <web-section key='admin-web-section' name='ScriptRunner generated web item - admin-web-section' location='system.admin.global' weight='200'>
                    <label>Web section</label>
                    <param name='lazy' value='true' />
                </web-section>
                <web-item key='contact-admin-team' name='ScriptRunner generated web item - contact-admin-team' section='system.admin.global/admin-web-section' weight='50'>
                    <label>Contact admin team</label>
                    <link linkId='contact-admin-team'>adaptavist.com</link>
                </web-item>
                <web-item key='contact-support-team' name='ScriptRunner generated web item - contact-support-team' section='system.admin.global/admin-web-section' weight='100'>
                    <label>Contact support team</label>
                    <link linkId='contact-support-team'>adaptavist.com</link>
                   </web-item>

XML users will note that the above XML is not technically correct as it does not have a root element, but a root element is automatically added for you in this case.

On this page