How to default a lookup filter field to the logged in user.

book

Article ID: 197336

calendar_today

Updated On:

Products

Clarity PPM On Premise Clarity PPM SaaS

Issue/Introduction

I want to use a filter field that automatically filters data by the logged in user, but the filtered data is not according the logged in user why?

When UserB filters data, the data returned is filtered to UserA

 

Cause

Logged in users must explicitly set their user to be the default value on their filter view 

Resolution

1.Let use the following lookup as an example:
SELECT 
@SELECT:u.id:[email protected],
@SELECT:u.user_name:[email protected],
@SELECT:r.id:[email protected],
@SELECT:r.unique_name:[email protected],
@SELECT:r.first_name:[email protected],
@SELECT:r.last_name:[email protected],
@SELECT:r.full_name:[email protected]
FROM 
srm_resources r, 
cmn_sec_users u 
WHERE u.id = r.user_id
@BROWSE-ONLY:
AND [email protected]:PARAM:[email protected]
:[email protected]
AND @[email protected]

2. Create an attribute on the project object linked to the above lookup
3. Studio > Object > Views > List filter view (add the attribute to the view)
4. Studio > Object > Views > List filter > Fields > Edit the field and add a default value. 
5. The only value available is the one of the user you are logged in with: UserA
6. Now the project list filter field is defaulted to UserA
7. If UserB logs in, the filter field defaults to UserB, but the filtered data belongs to UserA whch is the default value at the attribute level.
8. As userB through the Configuration wheel, Options > Configure > Filter section > Edit the attribute properties
9. Set UserB as default and save

Once UserB has explicitly set his user as default, the filter field will default to himself and the filtered criteria will also be proper.