I want to write a Confluence user macro, which should get a unique uuid. Currently I fail to randomly generate this UUID.
The format should look like "#c199f52d-9724-4911-ad47-479e937d3b88".
I guess I can solve this, if someone shows me how I can access the java function Math.random(); from my user macro.
This is how I do it. I was never able to find a good way to generate a random number or find a way to get at Math.random() but this seems to work well.
#set( $id = $action.dateFormatter.calendar.timeInMillis )
Even when the user macro is used multiple times per page I find that I get different mills. So for velocity I reference it this way ...
var id = '$id';
var stuff = AJS.$('#' + id).html();
Is there a way to do it within the user macro so that it is dynamic?
Maybe sharing a bit more detail on what you are trying to do would help?
Hi, Confluence collaborators! As part of #Confluence-Collaboratory month, we’ve created a very special Mythsbusters segment, where we're dive into an interesting myth and uncover the truth behind i...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events