code returns group names in the form [object,object], not the group name.

Hi,

i am trying to get the names og the currently logged in users group.my code returns the groups but in the form [object,object],, not the group name. how can i find the name of the group out of this object.I am using Jquery.

Thanks,

Asif

2 answers

1 accepted

HI,

Thanks for all help and support. I caold finally complete my code and its working fine.

Thank You,

Asif

Try var myObject = AJS.$(objectToTransform). If this doesn't help you please show your source code and we will find a solution.

jQuery(document).ready(function() {

var abcd= [10];


//alert(getGroups("asif_khan"));

var abcd=getGroups("asif_khan");
for (var i = 0; i < 3; i++) {
alert(abcd[i]);
//var a= abcd[i]data.groups.items;
//alert(a);
}


//varb= abcd.groups;
//alert(b);

alert("hi");

if(project_name == 'Customer ')

{
//window.alert('Message goes here');
$('#popup_Support_').attr('checked','checked');
$('#popup_NotBillable_').attr('checked','checked');
$('#popup_Billed_').val('0');
}

});

function getGroups(user)
{
var groups;
AJS.$.ajax({
url: "/rest/api/2/user?username="+user+"&expand=groups",
type: 'get',
dataType: 'json',
async: false,
success: function(data) {
groups = data.groups.items;
}
});
return groups;
}

This the the code iam using.

PLease make the required changes in the code if you can.That will be very helpfull.

I tried with the method you provided, but didnot work.Please try that method too if possible.

Thanks alot,

Asif

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

82 views 0 5
Read article

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