Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do I match custom fields with Current User?

Erling Rostvaag April 19, 2016

I am trying to make a report in EazyBI to identify who is logged into confluence and extract issues based on their names.

Using the [Assignee].[User].getmemberkey(currentUser()) Works well if I want to check against reporter or assignee.

However it does not work when trying to compare with another user value in a custom made Field. Asking for matches with a spesific name Works, so I know that EazyBI is able to read the value in the Field.

How can I match it to the value of the currently logged in user?

3 answers

1 accepted

1 vote
Answer accepted
eazyBI Support
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.
April 21, 2016

HI!


CurrentUser() works only with default user dimensions, as this function returns user key value which is not imported in the custom dimension.

You can use CurrenUserName() function instead: 

[Field1].[Field1].getMemberByKey(CurrentUserName())

Could it be a solution for you?

 

Ilze / support@eazybi.com

 

Erling Rostvaag April 21, 2016

Tested and works perfectly.

0 votes
Aleks Yenin (Polontech)
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.
April 21, 2016

Hi,

To get loggined user in confluence :

$action.remoteUser,$remoteUser

The currently logged in user, or null if anonymous user.

User

0 votes
J.Fawkes
Contributor
April 19, 2016

This can be retrieved easily from the com.atlassian.confluence.user.AuthenticatedUserThreadLocal class which will give you the current logged in user as a com.atlassian.confluence.user.ConfluenceUser object.

ConfluenceUser confluenceUser = AuthenticatedUserThreadLocal.get();

Erling Rostvaag April 20, 2016

It seems to me Your answering a different question than the one I asked. I want EazyBI to identify the current logged in user in confluence and compare it to the value in a Jira-Field so that the diagrams and such Return all issues With that persons id in my custom made Field.

J.Fawkes
Contributor
April 20, 2016

Could you please write the way you try to get user value in a custom made Field?

Erling Rostvaag April 20, 2016

Let's call the custom JIRA-field "Field1"

At first i tried this code with assignee, and it shows me graphs and diagrams with all the issues where I am the assignee (the currently logged in user in cofnluence or eazyBI for that matter)

[Assignee].[User].getMemberByKey(CurrentUser())

Then i tried applying that in the new field (Custom field in dimension category) wich is also a field that only allows for JIRA users as a value.

[Field1].[User].getMemberByKey(CurrentUser())

 

This returned nothing.

Double-checked by adding a calculated member that said
[Field1].[Doe, John]

 This returned all cases where John Doe was registered in the custom field, so nothing wrong with the data in itself.

Then I tried a bunch of variations that either returned nothing or gave me error messages that said I could not compare dimensions with labels and so on.

Example 1: IIF([Field1] = CurrentUser(), result1, result2)

Example 2: IIF([user].getMemberByKey(CurrentUser()) = [Field1], result 1, result 2)
(No function matches signature  <Member> = <Dimension>

Example 3: [Field1].[user].getmemberByKey(CurrentUser()) = [Field1].CurrenMember (or currenUser etc) AT this point I was just experimenting.

I'm pretty new to this (and self-taught) so I'm probably barking up the wrong tree entirely and should maybe just discard my attempts? smile

J.Fawkes
Contributor
April 20, 2016

It seems that [Field1] accept String values which are UserName.
You might try to  [Field1].[CurrentUser()]

Erling Rostvaag April 20, 2016

I tried adding a calculated member that said [Field1].[CurrentUser()] and nothing more.

It Returns no values and it does not work With the assigne Field instead of Field1 either.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events