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 10:24 PM
Hi,
are you sure it is able to query question_choice table?
try this
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.indexOf(gr.text.toString()) > -1)
            {
                return gr.text;
            }
        }    
    },
    type: 'GetCompany'
});
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:28 PM
before calling script include it should through alert i have commented all code expect that alert then i checked but it is not reaching to client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2022 10:38 PM
don't use includes use indexOf
function onLoad() {
    
    
  //alert(g_form.getDisplayValue('company'));
    var company="Visteon 1";
    alert(company.indexOf('Visteon') > -1);
    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);
    }    
            }
    
    
}
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:48 PM
is not the above code for only specific users client script is not reachable
now i have given one line of code
alert("reaching inside");
commented everything what i have witten
but still not that users client script is not reachable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2022 10:51 PM
Hi,
Sorry I didn't get you.
you are saying client script itself is not triggering when you change?
OR Ajax is not working for that user?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
