How to restrict catalog form to only particular users?

Venkat141
Tera Contributor

How to restrict catalog form to only particular users?

 

@Ankur Bawiskar 

@Saurav 

@shloke04 

@Anil Lande 

@Maik Skoddow 

@Jaspal Singh 

@Sandeep Dutta 

@Chandra Sekhar Maganty 

@Musab Rasheed

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Pavan Ramireddy 

use advanced script in user criteria and then add this user criteria in Available for related list of that item

As recommended practice please use user_id to get logged in user sys_id

var rec = new GlideRecord('sys_user');
rec.get(user_id);

if (rec.u_division == 'OIT Information Technology')
	answer = true;
else
	answer = false;

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

13 REPLIES 13

Community Alums
Not applicable

@Rahul Raja Samineni 

This was not part of your original question. Please ask specific questions.

Check this "Advanced" option and write your script.

find_real_file.png

Something like this:

var user = new GlideRecord('sys_user');
user.get(gs.getUserID());

if (user.u_division(your field name)== OIT Information Technology value)
{
return true;
}
return false;
}

 

 

Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep

 

 

Hii @Pavan Ramireddy 

 

Open you catalog item navigate to related list 'Not Available for' create new user criteria form will open  click on advance check box and do the code like:

var gr = new GlideRecord("sys_user");

     gr.addQuery("sys_id",gs.getUserID());

   gr.addQuery("division","OIT Information Technology");

    gr.quey();

if(gr.next()){

return false;

}

 

Thanks & Regards,

Imran Ahmad.

 

Mark Correct Answer

Mark Helpful below:-

Imran Ahmad1
Kilo Guru

Hii @Pavan Ramireddy 

 

Do you want to apply restriction on Catalog or Catalog items, if catalog item then you need to navigate maintains items click and open the item you want to restrict from someone, See the related list below there should be tabs like: 'Available for' , 'Not Available for' if you not able to see then right click on on top of header and go to Related List and Add, Tab on related list 'Not Available for' click new give name of user criteria and select the user or group or role etc you want to restrict and save.

you will definitely achieve you requirement:

 

 

Thanks & Regards,

Imran Ahmad.

 

 

Mark as Correct answer

Mark as helpful below:-

 

Ankur Bawiskar
Tera Patron
Tera Patron

@Pavan Ramireddy 

use advanced script in user criteria and then add this user criteria in Available for related list of that item

As recommended practice please use user_id to get logged in user sys_id

var rec = new GlideRecord('sys_user');
rec.get(user_id);

if (rec.u_division == 'OIT Information Technology')
	answer = true;
else
	answer = false;

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Pavan Ramireddy 

Hope you are doing good.

Did my reply answer your question?

If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader