Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Can I get a ScriptRunner custom macro body in storage format?


I'm writing a ScriptRunner custom macro that will process its body, but I'd prefer to process storage format (which is valid XML) rather than view format (which isn't). Looking at ConversionContext, there are methods to convert storage to view but (not surprisingly I guess) not the other way round. 

As explained at, the macro body is available in the body variable, but this appears to be view format and I don't see any way of requesting storage format. I checked whether there were any other hidden variables (such as bodyStorage) in the binding, but there don't appear to be.

Any ideas? Thanks.

UPDATE: I created a simple example that uses the "status" macro. Here is the storage format (I've inserted some line breaks to make it more readable):

<p class="auto-cursor-target"><br /></p>
<ac:structured-macro ac:name="inspect-body" ac:schema-version="1"
<ac:structured-macro ac:name="status" ac:schema-version="1"
<ac:parameter ac:name="title">Status</ac:parameter>
</ac:structured-macro> <p class="auto-cursor-target"><br /></p>

inspect-body is my custom macro and it just returns the body HTML as literal text. The weird thing is that I'm seeing different view formats when previewing the macro in the macro editor:

<img class="editor-inline-macro" height="18" width="88"

...and when saving the page (again I've added some newlines in both cases):

<p talk-marker="1" talk-page-id="116228112" talk-page-version="7">
<span class="status-macro aui-lozenge conf-macro output-inline"
data-hasbody="false" data-macro-name="status">STATUS</span>

I guess I need to be able to process both of the above (because I want the macro logic to execute both in the editor and when saving the page) but of course the <img> tag isn't terminated, so I can't parse it as XML. I guess I'll either preprocess it to make it valid XML or else do a naive parse (I don't care about the full details of the XML; I just want some bits, e.g., the status macro text).

Does this additional information help to point to the source of the problem, if indeed it is a problem?

Also, I don't suppose it's relevant, but the SR version is 6.36.0.

1 answer

0 votes
Fabian Lim
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jan 09, 2022

Hi @William Lupton

I suggest you also contact adaptivist support directly for faster support.


Thanks @Fabian Lim and sorry for the delay in replying. Yes I will create a support ticket but in the meantime I have avoided the problem in the way that I suggested.

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events