The CreatorCon Call for Content is officially open! Get started here.

Script include and client script is not working, however same is working in bg script

Mounika5
Tera Contributor

 

Below are the script include to find the model name already exists in the cmdb_hardware_product_model table. However I am unable to get the result value in the client script. Script is working in Background scripts.

 

Any suggestions?

 

 

This is the Script Include  I have used but the result I am unable to get. However background script is giving correct resultThis is the Script Include I have used but the result I am unable to get. However background script is giving correct resultThis is the client scriptThis is the client script

 

3 REPLIES 3

Hemanth M1
Giga Sage
Giga Sage

HI @Mounika5 ,

 

 

 

i could see get attribute state line number 7 this not required when you getXMLAnswer

 

just use alert(result) in line 17

 

I would also verify below :

 

1)Verify Script include is client callable

2)I would log and see paramter sent from Client side in script include

3)Log and print the output

4)if its not working , i would return some static value from script include like return "Mounika" to verify client - script include communication is good.

 

 

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

Danish Bhairag2
Tera Sage

Hi @Mounika5 ,

 

  • Change line number 15 to ga.getXML(response);
  • Line no 17 to var result1 = response.responseXML.documentElement.getAttribute("answer");

Then try your code.

 

Thanks,

Danish

 

Sandeep Rajput
Tera Patron
Tera Patron

@Mounika5 Since you are already using getXMLAnswer, no need to result.responseXML.documentElement.getAttribute. Replace line number 17 in your client script with the following.

 

 var result1 = result;

 

Hope this helps.