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

can we restrict users watchlist and group watchlist to certain catalog items in portal ?

Thej1
Tera Expert

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.

 

Thej1_1-1717134195690.png

 

Thanks

@Community Alums @Mark Manders @Arpan Baishya @Amit Gujarathi @Allen Andreas @Adil AZ 

1 ACCEPTED SOLUTION

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')

 

View solution in original post

6 REPLIES 6

Hi Kieran,

 

1. I have included the below script and it is working.

             var item = gr.cat_item;
             if(gr.cat_item == '1ad40c8c1bf5b550ed6241d7bd4bcbe0')
             {
             data.canView = false;
             }
             else
             data.canView = true;
 
Here hardcoded the sys id of the catalog item we want to hide.
 
2. Now the client came up with the requirement, a check box needs to be created on the catalog      item form and when it is checked the watchlist should be shown to only that particular            checked check box catalog items.
   
created a check box 'Show Watchlist' and included the below script in the server script of widget. But it is not working. It is showing for the all catalog items irrespective of checked ones.
Could you please have a look and suggest any changes required ?
            var gr_cat_item = new GlideRecord('sc_cat_item');
            gr_cat_item.addEncodedQuery('u_show_watchlist=true');
            gr_cat_item.query();
            if (gr_cat_item.next()) {
                data.canView = true;
            } else
                data.canView = false;
 

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')