How to restrict product model records based on selection particular account in CSM portal in SNOW

Srinivasu2
Tera Contributor

Hi Community,

 

I have created new case form in CSM Portal and we have fields like Accounts and product (taken reference as Product model table)

 

we need to restrict Product based on selection of each particular account (means if we select one particular account it will show only that particular account products on Product field 

 

Srinivasu2_0-1710394225276.pngSrinivasu2_1-1710394584485.png

 

If we can restrict the field via script include and add here advanced reference qualifier, could you please share the script include code.

 

Thanks,

Srinivasu

 

 

6 REPLIES 6

@Srinivasu2 
then use this code 

getSoldProductRefQual: function(account) {
    if (gs.nil(account))
        return;
    
    var gr = new GlideRecord("cmdb_model");
    gr.addQuery('account', account);
    gr.query();
    
    var listOfSoldProducts = [];
    while (gr.next()) {
        if (gr.canRead())
            listOfSoldProducts.push(gr.sys_id + '');
    }
    
    return "sys_idIN" + listOfSoldProducts.join();
}

Please hit helpful and accept this as a solution if it solved your problem.
Thank you!

Kokila Vani
Tera Contributor

Hi,

 

Could we able to restrict Product models based on some user persona's, say some roles or groups...

When "requested_for" selected has some role(say "X")  in service catalog, only some Product Models should be shown. like how we have user_criteria for "service catalog".

 

Thanks,

Vani