How to limit the user list when checking out on the catalog?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2024 03:34 PM - edited 12-31-2024 03:59 PM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2025 09:31 PM
so you want to show only those super users in that Requested For shown in order confirmation widget?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2025 08:44 AM - edited 01-03-2025 08:52 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2025 09:44 PM
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"
3) then clone the "widget-sc-cat-item-v2" widget and call the newly created widget at this line 23 in server script
4) Then add this newly cloned widget of "widget-sc-cat-item-v2" to the page you are using
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.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2025 08:56 AM
I don't have sc-cat-item-v2 in my instance, and I can't find any widget that appears to be like it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2025 10:47 AM
I gave sys_id's of widgets , could you please check those.