How to access variable createad on page in user macro?

Suppose I've created a variable $Var1 in the global template and define MyMacro in this template too.

I'd like to multiply $Var1 by 10 and print output by MyMacro.

So I need somehow to access $Var1 in Velocity template.

How can I do that so if user filled out $Var1 for example with 5 so after saving page 50 will be displayed?

Thanks.

1 answer

And having the user enter the value in a user macro body won't work?

There is option to create variables in Templates.

There is option to write own User Macro and use Velocity in Template section of User Macro.

When user creates new page from specified template he supposed to enter value in variable's field.

I want to get the content of the above variable in Velocity User Macro Template and do some action with it, so when new page is saved then my_user_macro produce output based on user input in variable field.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted yesterday in Confluence

Calling all marketing teams who use Confluence - we want to hear from you!

Hi Community! me again 🙂 If you’re a marketing team using Confluence, we want to hear your story! How did you start using Confluence? What are your use cases? What have been some of the benefits?...

129 views 3 3
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