Thursday 9 October 2014

Filter Records by Running User


Sometimes we want to see the records created by different User in Org and to achieve this we always create many custom list views having filter criteria "Owner Last Name " or "Owner First Name " which is fine if you few users but what will you do if number of users are large. You surely not going to create list view.

This limitation can be overcome by creating few formula fields and a list view.

Scenario:- 
Wanted to see the list of Account assigned to a particular Users.

1. To achieve this create one formula field [ Name = 'Formula Owner ' ]of type Number and decimal set to 0, and in formula editor write

IF( Owner.Id = $User.Id, 1, NULL) 

    Owner.Id represents Id of Owner of account
    $User.Id represent/give the Id os logged in User

and save the formula field.












2. Now to go Accounts and creates a new List view, where filter criteria would be 

Formula Owner = 1













set Visibility to "Visible to all users (Includes partner and customer portal users) "

3. Now see the list of record assigned to different Owner by logging in with different User
























Also see the Formula field value when seen as System Admin / another User who have access to that Account record and as Logged user who is the Owner of that Account record.


when owner and logged in user are different










when owner and logged in user are same










You can do similar type of customization for all the field which are related to Users or I would say have lookup on User i.e. CreatedBy, LastModifiedBy

No comments:

Post a Comment