Hi, I need to create a cookie in user macro environment, I can use the velocity context parameter $req, but this only work to get a cookie, not for create.
Can I do this?
Oh, you want to manage cookies on client side?
You can store cookie like this:
document.cookie = "theme=" + encodeURIComponent("blue theme") + "; max-age=" + 60*60*24*30 + "; path=/; domain=thesitewizard.com" ;
Also, Atlassian have api for managing cookies - https://developer.atlassian.com/display/AUI/AJS.Cookie - but it stores all values in one key/value map. But you can try it.
If there is strong requirement to store cookie in macro, then you have to add instance of CookieUtils to Velocity params and then call it like
$cookieUtils.createCookie($name, $value, $req)
Honestly, I didn't try to do that in Confluence macro. But I'm absolutely shure, that it work in Jira's Web Action.
Hope it helps :)
Welcome to your weekly Jira Ops Early access program update, where we’re sharing news and updates on Jira Ops' progress as we work toward our 1.0 release. If you ever want to drop us feedback or idea...
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!
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