Access restriction to a Catalog item

Venkatesh5
Tera Contributor

Hi All,

I have scenario. where I have to restrict users to view the Catalog items in Serviceportal based on the level(a custom field value from sys_user form) configured to the user. Below is the code and it is not working as expected. I am not able to view the gs.log() content under System log--> All which is written on below code.

Please share your thoughts to figure out the issue.

find_real_file.png

Thanks

Venkatesh.P

1 ACCEPTED SOLUTION

reginabautista
Kilo Sage

Hi Venkatesh,



Try the below solution (I've tested this in my personal dev instance)



var level= gs.getUser().getRecord().getValue('u_level');


var answer = false;


if(level>=6){


answer=true;


}



gs.log(answer);



Also ensure that this User Criteria is assigned in the 'Available for'   in your Catalog item. This is usually not visible on the form so you may need to do Configure->Form Layout then select Available For then save the form.


find_real_file.png




find_real_file.png


View solution in original post

12 REPLIES 12

Hi Regina,



Thanks for   your inputs that worked for me as well. Is there any possibility to have a customized message instead of "You do not have permission to see this category" in service portal, where we had this catalog item in new category called "security"



Thanks


Venkatesh.P


Hi Reginabautista,

 

Actually I would like to know how can we restrict the users from submission of catalog item based on field.

For example,

here if user select the employee for departure catalog item, they must not be able to submit the request.

if the user select the contingent worker then they must be able to submit the request.

Contingent worker and employee are differentiated based on expired date field in user table

 

Thanks

reginabautista
Kilo Sage

Hi Venkatesh, could you mark my answe as correct please so this gets removed from the unanswered list



As to the second question let me see what I can find. Though not sure if possible. Also ideally this should be created on a separate thread so it can easily be found by others who have similar question..