Choice value is not visible to customer but admin can see
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 04:27 AM
Hi,
I have added Business line (choice field )field in the Product model table. and same added in the Sold product table.
I have written a script include to show the Business line values in the catalog form based on account.
Script include
getBusinessLinePortal: function() {
var bl = [];
var account = this.getParameter("sysparm_account");
gs.log("Account " + account);
var dee = new GlideRecord("sn_install_base_sold_product");
dee.addEncodedQuery('account=' + account);
dee.query();
while (dee.next()) {
bl.push(dee.product.u_business_line_product.toString());
}
gs.log("Business Line " + bl);
return bl.join(',');
},
Client script
function onLoad() {
var account = g_form.getValue("csm_account");
var script_include = new GlideAjax('global.getProductPortal');
script_include.addParam('sysparm_name', 'getBusinessLinePortal');
script_include.addParam('sysparm_account', account);
script_include.getXML(showDetails);
function showDetails(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
var array = answer.split(',');
alert("Array " + array);
for (var i = 0; i < array.length; i++) {
g_form.addOption('u_business_line', array[i], array[i]);
}
}
}
Business line options are- Med, Max, Data
When I am impersonating with customer whose account is associated with Data and Med it is working fine but for Med customer Business Line is not visible.
Please help.
Thanks,
Sam
- Labels:
-
Customer Service Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2024 03:24 AM
I Understand
So the script include is triggering from your client script but the return value is empty right.
Looks like the issue is with the read access so make sure the roles are properly assigned.
Keep a log before below line and see the product, Business Line Product values.
bl.push(dee.product.u_business_line_product.toString());
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP