Client script is not working for specific users

Sriramachandra1
Kilo Contributor

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

@Ankur Bawiskar @Sandeep Dutta @Mark Roethof 

17 REPLIES 17

Ravi9
ServiceNow Employee
ServiceNow Employee

pls share ur actual code which is not working , we can work from there 

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 @Ankur Bawiskar 

 

take a look at ac code

 

in above sysid is refers variable in record producer

Hi,

so is the script include not getting called for that user?

what came in alert for answer?

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

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