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 Raw XML Module Item by following these steps:
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.
Copy the XML into the Raw XML Module script.
Make modifications as required.
Example
If you wanted to show a Google button with a tooltip that only shows on personal Confluence spaces, follow these steps:
- Fill out the custom web item form.
- Navigate to General Configuration > ScriptRunner > UI Fragments > Custom Web Item.
- Fill out the form with the following content:
- Name: custom-web-item
- What Section Should This Go In: system.header/left
- Key: custom-web-item
- Menu Text: Google something
- Weight: 70
Condition:
groovycontext.space && context.space.isPersonal()
- Do What: Navigate to a link
- Link: https://www.google.com
- Click Preview.
The following XML is generated:
- Copy the XML.
- Fill out the raw XML module form:
- Navigate to General Configuration > ScriptRunner > UI Fragments > Raw XML Module Item.
- Enter a Name like custom-web-item with added tooltip.
- Enter the XML you copied for the XML field.
- Make the following modifications to the XML:
Remove lines 4 and 5:
groovy<param name='£trackingParameters' value='{"scriptName":"com.onresolve.scriptrunner.canned.confluence.fragments.CustomWebItem"}' /> <param name='£fragmentParameters' value='{"id":"590d3bd9-54b6-4550-aa66-c2279100b6b1"}' />
Remove line 8:
groovy<styleClass> custom-web-item </styleClass>
Add the following code after
</link>
:groovy<tooltip>Click here to Google something</tooltip>
The modified XML should look like this:
- Click Add.
Result
This is how the button and tooltip will appear in your Confluence instance: