Client script is not working for specific users
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2022 01:48 PM
Hi Team,
i have created customer changes record producer for change req mgmnt
i have created a catalog client script to load put some values
i have written alert to check that script is reachable or not
i found issue with some users and a pattern
if i create a user in sys_user table and assign company and " itil "and "snc internal role" --client script is working fine
when i'm creating user from core_copmany giving same roles was not able to access client script
note: Both users are having same roles same company
it simple client script nothing complex
consider only one line of code alert("reacgeble load script");
can anyone help me overcome the issue
- Labels:
-
Change Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2022 07:38 PM
pls share ur actual code which is not working , we can work from there
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2022 10:13 PM
client script
function onLoad() {
//alert(g_form.getDisplayValue('company'));
var company="Visteon 1";
alert(company.includes('Visteon'));
var ga =new GlideAjax('GetCompany');
ga.addParam('sysparm_name','getDetails');
ga.addParam('Company',g_form.getDisplayValue('company'));
ga.getXML(getResponse);
function getResponse(response)
{
var answer =response.responseXML.documentElement.getAttribute("answer");
alert(answer);
if(answer!= null)
{
g_form.clearOptions('please_select_the_customer_specific_change');
g_form.addOption('please_select_the_customer_specific_change','','-- None--');
g_form.addOption('please_select_the_customer_specific_change',answer,answer);
}
}
}
script include
var GetCompany = Class.create();
GetCompany.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getDetails:function(){
var company =this.getParameter('Company');
var gr = new GlideRecord('question_choice');
gr.addQuery('question','a17c310087c64110fc692f49cebb351a');
gr.query();
while(gr.next())
{
if(company.includes(gr.text))
{
return gr.text;
}
}
},
type: 'GetCompany'
});
Hello
take a look at ac code
in above sysid is refers variable in record producer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2022 10:16 PM
Hi,
so is the script include not getting called for that user?
what came in alert for answer?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2022 10:20 PM
it is not going into client script for that users
for testing i have given this alert
var company="Visteon 1";
alert(company.includes('Visteon'));
it is reachable and working for first type of users and not working for second type of users