Look up a user profile attribute, to use in a macro

Martin Cleaver
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.
December 3, 2013

For any given attribute (user profile field), I'd like a way to use the value in a macro. Is this presently possible?

For instance, for a user jsmith, and user profile field 'postcode', I'd like to be able to get the value of either:jsmith's postcode or my own postcode.

Nearest thing I can see is https://support.communardo.de/display/upp/REST+API+Documentation#RESTAPIDocumentation-Getinformationaboutaspecificprofileelement-/profileElements/{elementKey} but I want this for users / administrators.

Thanks,

Martin.

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Matthew J. Horn
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.
December 3, 2013

In a user macro, you can use the user accessor:

$userAccessor

This has a method, getUser(user_name), which you can use to get the user by name. This method is deprecated in 5.2, but it will work until probably the next major revision. You should be able to access properties of the User object to do what you want.

Martin Cleaver
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.
December 3, 2013

Great, thanks Matthew!

0 votes
StephanieC
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.
December 4, 2013

Hi Martin,

yes, this is possible with our REST API. With the link you provided you will retrieve information of the element (e.g. the key, the user profile configuration). If you want to retrieve the value of a single profile element for a certain user you need to do this call.

In the case of the postcode (assumption: key of the postcode field is 01050669159) of jsmith the request would look like this:

<Server Base URL>/rest/communardo/upp/1.0/profileData/jsmith/01050669159

The element key can be retrieved via the REST API, too.

<Server Base URL>/rest/communardo/upp/1.0/profileElements/?expand=profileElements

will list you all profile elements and their configuration, in the same order as defined via the User Profile Plugin Configuration. All you need to do is parse the key for the profile field you need.

I hope this is what you need. Otherwise please do not hesitate to contact me again.

Greeting, Stephanie
Communardo Support

TAGS
AUG Leaders

Atlassian Community Events