Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to restrict Knowledge base based on sold products

Samiksha2
Mega Sage

Hi All,

 

I have a requirement to show the Knowledge bases based on sold products.

I have added the below script in user criteria

var con = new GlideRecord('customer_contact');
con.addEncodedQuery('accountISNOTEMPTY');
con.addQuery('sys_id', user_id);
con.query();
if (con.next()) {
    var acc = con.account.getDisplayValue();
    var pro = new GlideRecord('sn_install_base_sold_product');
    pro.addEncodedQuery('account=' + acc);
    pro.query();
    if (pro.next()) {
        var sold = pro.name;
        if (sold == "Adobe Systems InDesign 5.5") {
            answer = true;
        }

    }

}

And added this to Can Read related list tab.

 

Please let me where I am doing wrong?

 

Thanks,

Sam

0 REPLIES 0