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

reporter via javascript

Mehdi Yousefi July 2, 2011

hi
i have a problem in javascript in jira,is it possible to access the value of the current user or reporter in the form before creating issue?
i want to show current user in a feild without possible to edit, i just know this way :

var reporter = document.getElementById('reporter');

so when i dont put reporter feild in the form then i cant use the value of reporter.
how can i reach to value of reporter without putting reporter feild in form??!!!

5 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
Colin Goudie
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2011

Why don't you use a REST call to '/rest/auth/latest/session' which retreives information about the current user. Then use that information to populate the reporter field?

http://docs.atlassian.com/jira/REST/latest/#id35825400

Mehdi Yousefi July 3, 2011

yeah REST is the solution for this issue, i`m reading REST doc now , i have`nt used that before , thanks for your guidance

1 vote
Penny Wyatt (On Leave to July 2021)
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 2, 2011

I think the easiest way would be to make a call to the REST API from JavaScript and retrieve the value from the server.

http://confluence.atlassian.com/display/JIRA/JIRA+REST+API+(Alpha)+Tutorial

For example, if you make a request to http://jira.atlassian.com/rest/api/2.0.alpha1/issue/JRA-9, you will get back all the available information about the issue, including the reporter details, regardless of what is on the current form. All you'll need is the issue key.

0 votes
Edwin Chan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 3, 2011

You can accomplish this with a plugin and one line of code:

- Install the JIRA Toolkit Plugin

- Create a new custom field of the type "Velocity processed Message Custom Field (for view)"

- Set the default value for the context to:

$issue.getReporter().getFullName()

- Add custom field to view screen

Mehdi Yousefi July 4, 2011

very usefull answer

0 votes
Mehdi Yousefi July 3, 2011

yeah REST is the solution for this issue, i`m reading REST doc now , i have`nt used that before,thanks for your guidance

0 votes
Mehdi Yousefi July 3, 2011

hi penny

therefore i cant use javasript for my purpose.

thanks for your answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events