AJS.params.loggedInUser returned login id - what is the equivalent for full name

Hi All,

The below gave me the user login id , do any one know what is the equivalient for user full name ? - Please let me know thanks.

AJS.params.loggedInUser

Is there a document on the above?

Thanks

Saran

3 answers

1 accepted

1 votes

You need to invoke the REST API to get additional user details. This post has some code: http://www.j-tricks.com/1/post/2012/02/some-ajs-tricks.html

Thanks - I will check this out

can i add it directly in the java script or do i have to do any additonal settings?

When I add it as below - it returns undefiend values in the summary field.

<script type="text/javascript">

var reporter = getCurrentUserName() ;

if (document.getElementById("summary").value == "") {

document.getElementById("summary").value = reporter;

}

function getCurrentUserName()

{

var user;

AJS.$.ajax({

url: "/rest/gadget/1.0/currentUser",

type: 'get',

dataType: 'json',

async: false,

success: function(data) {

user = data.username;

}

});

return user;

}

</script>

function getCurrentUserName()
{
var user;
AJS.$.ajax({
url: "/rest/gadget/1.0/currentUser",
type: 'get',
dataType: 'json',
async: false,
success: function(data) {
user = data.username;
}
});
return user;
}

What version of JIRA is it? Yes, you can add it in in javascript. Also, can you alert the username alone?

What exactly is undefined?

you can refer https://jamieechlin.atlassian.net/wiki/display/GRV/Script+Runner

to simplify your work. its groovy script.

you can get full name using

jQuery('#header-details-user-fullname').html();

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,802 views 11 18
Join discussion

Atlassian User Groups

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!

Find my local user group

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

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot