How to restrict product model records based on selection particular account in CSM portal in SNOW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 10:40 PM
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2024 11:53 PM - edited 03-13-2024 11:54 PM
Hi @Srinivasu2,
You can create a reference Qualifer on Product variable here how you can do this
Reference Qualifier code
javascript:new sn_contributor.ContributorUserPortalUtils().getSoldProductRefQual(current.variables.account)
Script include code
getSoldProductRefQual: function(account) {
if (gs.nil(account))
return;
var gr = new GlideRecord("sn_install_base_sold_product");
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 also check the screen shot below
Please hit helpful and accept this as a solution if it solved your problem.
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2024 12:11 AM
Hi @M Ismail ,
I have taken reference table as Product model(cmdb_model) instead of sold product table.
Could you please share script include code for Product model(cmdb_model)? it will be very helpful for this
Thanks,
Srinivasu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2024 12:24 AM
Hi @Srinivasu2,
What's the criteria like on what basis you want to show the cmdb_model like I can't see the account in cmdb_model table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2024 12:33 AM
Hi @M Ismail ,
Client will be provided CMDB model table data we need to import and attach to account.
we can see product model in Account under related lists.
Thanks,
Srinvasu