Retrieve Current User

SaraBTIT
Contributor

Retrieve Current User

Hello,

I can use item(user list) to get current user, i.e. the user who login current system, it requires to use user list as dimension. Now I have a module which is not dimensioned user list, is it possible to retrieve current user directly without adding user list as dimension? 

Thanks in advance. 

8 REPLIES 8
kevin.cho
Certified Master Anaplanner

Re: Retrieve Current User

To retrieve the user in the way that you described, you do need the User list to be one of the dimensions. 

 

What specifically are you trying to achieve, or what do you want to use the "Current User" for? There may be another way to achieve your goal. 

SaraBTIT
Contributor

Re: Retrieve Current User

@kevin.cho  Thanks for your reply Kevin. I'd like to customize a dashboard, so that it will dynamically display the module for each specific user. Those users have access to the list related to the module, but that's not enough, we have to embed another condition to restrict their access. I need to get 'current user' in order to bundle the current user with the condition. 

kevin.cho
Certified Master Anaplanner

Re: Retrieve Current User

Do you mean to change the filter condition on a module depending on the specific user? 

 

If so, a line item (that acts as a filter) dimensioned against the User dimension, can be applied to a module that doesn't have the User dimension applied. 

 

(Screenshots didn't appear)    

2021-01-11 14_18_14-Anaplan - [POC] Kevin's Generic POC Model and 6 more pages - Personal - Microsof.png2021-01-11 14_17_30-Anaplan - [POC] Kevin's Generic POC Model and 6 more pages - Personal - Microsof.png

2021-01-11 14_19_00-Anaplan - [POC] Kevin's Generic POC Model and 6 more pages - Personal - Microsof.png

SaraBTIT
Contributor

Re: Retrieve Current User

@kevin.cho  Thanks Kevin. More exactly,  the condition I tried to set is current user = the approver,  'the approver' is a line item in that module, it's not dimensioned as user list. I need to build a Boolean to get TRUE/FALSE for 'current user = the approver', then use the Boolean as filter on that dashboard. Merely current user won't be enough. The painpoint is that the Boolean doesn't work if I don't use user list as dimension. I'm stuck here...I also tried to apply user list as a dimension and build a subsidiary view for the Boolean line item, on the dashboard filter, it will not appear current user/current page, instead it will take the exact user/current page... 

kevin.cho
Certified Master Anaplanner

Re: Retrieve Current User

Hi @SaraBTIT 

 

Just to confirm, in your example you have:

  1. A module with dimensions of list A (and potentially others)
  2. A line item within the module (with same dimensions) called "Approver", formatted as "Users"
    1. For each item in List A, this Approver value is populated with a User 
  3. You need to filter the module to only show items in List A where the Approver value is the same as the User who is viewing the dashboard

If this is correct, you can still use what I had above:

  1. Create a line item dimensioned against list A and Users called "Filter"
    1. Formula: ITEM(Users) = Approver 
  2. Apply this "Filter" line item to the module. 

Example:

2021-01-11 15_01_38-Anaplan - [POC] Kevin's Generic POC Model and 8 more pages - Personal - Microsof.png

 

2021-01-11 15_02_50-Anaplan - [POC] Kevin's Generic POC Model and 8 more pages - Personal - Microsof.png

 

 

SaraBTIT
Contributor

Re: Retrieve Current User

@kevin.cho  Hi Kevin, since the Filter is dimensioned against user, the problem is when I tried to apply the Filter on dashboard, it can only filter the exact user, instead of 'current user', kindly find below yellow highlighted part.  I think it's difficult to apply this kind of filter if my module doesn't use User as dimension...

SaraBTIT_0-1610348515409.png

 

kevin.cho
Certified Master Anaplanner

Re: Retrieve Current User

Oh I see! Okay, so you have been using the non-system Users list, i.e. a "Fake" users list (similar to Fake Time). 

 

The system Users list has this special behaviour that allows the filter to still be applied; your situation is akin to using just a default type of list, which yes does need the dimension being applied.

 

You can potentially still do this however by creating two line items; one against the Users list formatted with "User List", and then another boolean formatted which you apply as a filter. If there is a mapping between the System "Users" list and your non-System "User List", create a line item that returns the item from the System "Users" list. 


E.g. 

If Approved By is the name of the line item formatted by "User List", then you can do something like below (assuming names of the items in "User List" are email addresses that correspond to the system User list)
Mapped User = FINDITEM(Users, NAME(Approved By))

You can then do everything as previous, but now referencing this "Mapped User" line item. 

 

 

Is there a reason why you use your own "User List" rather than "Users"? 

 

 

 

 

SaraBTIT
Contributor

Re: Retrieve Current User

@kevin.cho  Thanks a lot Kevin for your suggestions. I'm able to solve the problem now. The reason that we use fake user list is because the business requires to write data into user list and save the data, system Users list can't achieve the expected result so we had to build a dummy list for users.