Set User Macro Parameter Value from Javascript

Hi, I'm new to confluence and am working on my first User Macro.  It has 1 parameter, html and javascript (that's rendered).  The html and javascript comprise a multi-picker. I want to use the picker to set the value of the parameter but I can't figure out how to save the result.

From javascript, how do I set the value of a user macro parameter?

Right now, when I save.. the picker appears in the page that's created rather than the values I selected – despite the fact that I programmatically remove it before saving.


1 answer

As I understand it, user macros are executed when the page template is rendered, which is before executing JavaScript.  You need for the JavaScript to leave its state, and then reload the page, with the macro picking up the value when it is re-rendering. I've done that using HTML parameters.

You can get HTML parameters from the $req object, which is the current servlet request object, and is available in the Velocity context.

#if ($value)
## use that as the parameter value
## Use the default parameter or whatever you have

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,076 views 13 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot