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

Restrict Available Catalog Item

Patrick Rodrigu
Tera Contributor

Hello,

I'm writing a Before BR Query to restrict the available items in the Catalog Item list when adding questions to a report.

Current script: 

if (!gs.hasRole('admin') && !gs.hasRole('catalog_admin') && gs.hasRole('itil')) {

        var arrAllowedCatalogItems = [
            'item1SysID',
            'item2SysID'
            'Item3SysID'
        ];       
        current.addCondition('sc_cat_item', 'IN', arrAllowedCatalogItems.join(','));
    }

PatrickRodrigu_0-1723045551099.png


Two questions:
1. Should the BR be triggered on the main report table "task", sc_cat_item, or question_answer:
2. Am I missing anything in my script

2 REPLIES 2

Mio Matsushita
Mega Sage
Mega Sage

Hi

 

If the table for this Query BR is sc_cat_item, isn't the field being queried sys_id?

current.addCondition( 'sc_cat_item' , 'IN' , arrAllowedCatalogItems.join( ',' ));

current.addCondition( 'sys_id' , 'IN' , arrAllowedCatalogItems.join( ',' ));

First of all, User Criteria can be used for catalog items.
If User Criteria meets your requirements, we recommend using User Criteria rather than Query BR.

 

Also, if simple conditions are sufficient for the restrictions, consider using ACL.

Thank you for the update.

 

I was unsure which table to use for the Query BR as the report is using the "incident" table and we wanted to restrict the items listed when users want to add variables/variable answers as columns for records submitted through a Record Producer.