I have created some documentation on Confluence for my colleagues to use. I would like to allow them create a Jira issue from my page as described in Creating Issues via direct HTML links. Here is a sample of my HTML code:
<a href="https://seg-jira.csg.apple.com/secure/CreateIssueDetails!init.jspa?pid=10000&issuetype=4&summary=''&reporter=Riad Kaced">[File a Jira Task]</a>
Reporter being a mandatory field, I would like to set it to the current logged-in user. It is hard-coded to myself in the example above, however I want to improve my code to use the current logged-in user instead. A similar topic was discussed @ How do I find out current logged in user? The answer was:
ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
Pasting the above verbatim into my HTML code won't work, hence my question: How to find the current logged in user with a syntax I can incorporate in my HTML code?
Cheers
Hi,
If you are on Confluence and using the same user base as on JIRA, you can derive the current user in Confluence User Macro with
#set($reporter= $paramReporter)
#if (!$reporter)
#set ($reporter=$action.remoteUser.name)
#end
and complete whole HTML link.... like....
<a href="$paramJiraurl/secure/CreateIssueDetails!init.jspa?pid=$paramProjectid&issuetype=$paramIssuetype&reporter=$reporter&assignee=$assignee&summary=$paramSummary&description=$paramDescription&$paramAppendtext">$paramLinktext</a>
Check User Macros in Confluence for more.
this worked for us, I hope this help to you as well.
Not specifying the reporter should cause the field to default to the currently logged-in user, just as is the case when you click the Create button, but there is a bug that causes that not to happen - https://jira.atlassian.com/browse/JRASERVER-25308 A workaround mentions using a Behaviour, which you may consider doing if you have ScriptRunner installed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.