The CreatorCon Call for Content is officially open! Get started here.

How to limit the user list when checking out on the catalog?

gjz
Mega Sage

In my company, we have "super users" who are allowed to order items on behalf of other people in their department.  They don't have an ITIL role, they have a modified ITIL role that was created for them.

 

When a catalog item is ordered, on the Order Confirmation popup, the Request for field needs to be limited to the people in the department if the logged in user is one of the "super users", all other users will retain the OOB functionality.  What is the best way to do that?  Can it be done through a business rule or do I have to clone and modify the sc-checkout widget?  If it has to be in the widget, can someone point me to where the code will need to be modified?  I'm not good at modifying widgets.

 

I've done some searching and I find there is a system property "glide.sc.request_for.query" that seems to be used to determine who is in the list.  Can I put complex javascript in the property's value?  How does the widget know who the logged in user is?

 

 

 

gjz_0-1735687984894.png

 

9 REPLIES 9

@gjz 

so you want to show only those super users in that Requested For shown in order confirmation widget?

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

No, Admin and ITIL users will need the OOB behaviour and be able to select anyone in the users table.  The super users need to be limited to only the people in their department.

 

I've seen a property - glide.sc.request_for.query with the value active=true.  I can't figure out how to modify this property to use custom code, assuming it relates to the cart.

 

@gjz 

It involves lot of customizations which I won't recommend.

1) First widget is the SC Catalog Item widget [widget-sc-cat-item-v2]. This actually calls another widget: sc-checkout. So you need to clone 2 widgets.

2) you will have to clone sc-checkout widget and then add filter in <sn-record-picker> to show users with role as super user. add this attribute in the <sn-record-picker> tag

default-query="role=superUserRole"

AnkurBawiskar_0-1735882646853.png

3) then clone the "widget-sc-cat-item-v2" widget and call the newly created widget at this line 23 in server script

AnkurBawiskar_1-1735882809563.png

4) Then add this newly cloned widget of "widget-sc-cat-item-v2" to the page you are using

AnkurBawiskar_2-1735882931850.png

I hope I have provided enough answer and guidance and you can complete the requirement based on your developer skills.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

I don't have sc-cat-item-v2 in my instance, and I can't find any widget that appears to be like it.

 

I gave sys_id's of widgets , could you please check those.