Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Creating Issues via direct HTML links: How do I find out current logged in user?

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

2 answers

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.

0 votes
Payne Community Leader Feb 22, 2019

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.

Issue is still open.

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

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

Events near you