Filter List View based on Admin or normal user

  • 28 April 2020
  • 3 replies
  • 48 views

Hi, 

 

I have a list that I want to filter based on if a user is "Admin or Normal user", so if a user fills in a request than on submit Admin should be able see all the request submitted. The user should see Only what they have submitted. If the user is anonymous they should not see nothing because they are anonymous. 

 

Thanks


3 replies

Hi TheDon54


 


Would you please check out the “13. Set the Current User's Details on the Request Form” steps here: https://help.k2.com/onlinehelp/k2five/userguide/current/default.htm#Tutorials/Build/LeaveRequestBasic/13SetCurrentUserDetails.htm%3FTocPath%3DTutorials%7CLeave%2520Request%2520(Basic%2520Version)%7C_____13. You may also see go to those steps in these videos:


K2 Tutorial: Leave Request (Basic) – Build: https://www.youtube.com/watch?v=k9XCg0_PDCo&t=3320s,


How-To: Basic Leave Request Build: https://www.youtube.com/watch?v=1SEuv2sF4GE.


 


Best,


Sunrise

Badge +7

Hello  @TheDon54 
Filtering a list view by the logged on user: https://community.k2.com/t5/K2-Five/Filtering-a-list-view-by-the-logged-on-user/td-p/108743


 


Filter List View based on multiple rows from hidden list view: https://community.k2.com/t5/K2-Five/Filter-List-View-based-on-multiple-rows-from-hidden-list-view/td-p/108912


 


List view: Filter based on active directory group membership: https://community.k2.com/t5/K2-Five/List-view-Filter-based-on-active-directory-group-membership/td-p/111806


 


Searching and Filtering List Views: https://help.k2.com/onlinehelp/k2five/userguide/5.3/default.htm#Use/Filtering-On-List-Views.htm;


 


Filtering listview with where in condition: https://community.k2.com/t5/K2-Five/Filtering-listview-with-where-in-condition/td-p/111132


 


Multiple list view filteration using different controls (smartforms) : https://community.k2.com/t5/K2-Blackpearl-Forum-Posts/Multiple-list-view-filteration-using-different-controls/td-p/90240


 


Enjoy.

Hi there  @TheDon54 


 


I hope you are well.


 


I think you can acheive thsi using the following steps.


 


In your smartObject make sure that you have FQN field, if not add one.


Then in your List view transfer the fqn from system value when a new row is add then add a filter to handle normal users (have a look on the attachment for guide on this)


 


Then in your form make unbound rule for the administartor


i.e if an advanced condition is true (your advanced condition should be like this: email = denallix/administrator)


        then execute a list method (configure)  without adding any filters


    else



  • then execute a view method on the list view which is initialize  


then on your submit button execute your unbound rule when the button is clicked


 


All this should guide you to achieving your goal


 


Let me know if this helps!


 


Kind regards 


HulisaniN


 


Reply