- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 10:46 PM - edited 05-30-2024 10:48 PM
Hi,
We have enabled the users watch list and group watch list in portal for the My Requests of RITM's.
Now is it possible to restrict this to certain catalog items ?
Please find the attached screenshot.
Thanks
@Community Alums @Mark Manders @Arpan Baishya @Amit Gujarathi @Allen Andreas @Adil AZ
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2024 02:39 AM
Hi,
Your server script isn't checking whether the current item has the checkbox, it's just performing a query to find all items with the checkbox being true.
//Assuming 'gr' is the sc_req_item record
data.canView = false;
var catItemGR = gr.getElement('cat_item').getRefRecord();
if(!catItemGR.isValidRecord())
data.canView = JSUtil.getBooleanValue(catItemGR , 'u_show_watchlist')

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 11:35 PM
Hi @Thej1 ,
You can write a Onload Catalog Client script to hide it when you are using that particular catalog Item.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 11:53 PM
Is this a custom widget you've added/created? What's the page ID? If the widget is custom, can you share the code and we can offer some guidance on how to amend
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2024 12:03 AM
Yes this is the custom widget we have created.
Here is the server script code of that widget.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2024 12:18 AM
Thanks for providing, a few options come to mind
- You're already checking whether the user can write to the watch list (good practice, I like it!). Have you introduced a new ACL? If so, you could add a filter condition to only allow adding to the watch list if the item aligned to the sc_req_item is one you define. This is the most secure option as you're preventing write access at the DB level
- Use widget instance options to define a whitelist. This option is a visual prevention and could be bypassed. Depending on the company/client policy, this may not be compliant
- Add a new instance option of type glide_list that references the sc_cat_item table
Add into your server script
var allowedCatalogItems = options.allowed_catalog_items;
if(allowedCatalogItems){
var allowedCatItemsArr = allowedCatalogItems.split(',');
data.canWrite = new global.ArrayUtil().contains(allowedCatItemsArr , gr.getValue(('cat_item')));
}