Script Include call is not working from SOW

AnnuK
Tera Contributor

I have a client script calling script include to populate some data in form. 

The client script is working in Classic UI but not working from SOW. 

 

I have updated Desktop Type as "ALL"

I tried SOW view also. 

 

I tested that Script include call is not working from SOW. 

How to solve this..?

 

Other client scripts that have no script include call are working in SOW without update any view. View is Global.

Does Script Include work from SOW by 

2 ACCEPTED SOLUTIONS

@AnnuK 

so what debugging did you perform in your client script.

Did you check if logs came? any browser console error when the onchange runs

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

Hello @AnnuK 

I have rebuilt your code. Please verify the screenshots below. Also, please cross-check the yellow highlighted area in your Client Script and Script include.

RushiSavarkar_0-1740735677619.png

Script Include

RushiSavarkar_1-1740735863912.png

1. In the script include, you will have to define "ID" variable as this.getParameter("sysparm_id");

2. The value of ID should be your Configuration Item.

3. Make sure cmdb_rel_ci is giving you the expected result with harcoded values before running the script

4. Isolate Script check box should be true

Result:

RushiSavarkar_3-1740736229541.png

 

RushiSavarkar_2-1740736142193.png

 

If my response helped you, please accept the solution and mark it as helpful.
Thank You!

View solution in original post

12 REPLIES 12

Ankur Bawiskar
Tera Patron
Tera Patron

@AnnuK 

ideally should work

Don't specify any view in client script and let it run for all views

are you sure there are no browser errors?

share your client script and script include scripts and their screenshots

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Divesh Naik
Tera Contributor

Hi @AnnuK ,

 

Check if you have specified any Access Control to your script include, make sure the logged in user is a member of it.

image.png

Mark this as Helpful / Accept the Solution if this helps.

Rushi Savarkar
Kilo Sage

Hello @AnnuK 

Ideally, it should work. But still, if we can cross-check the client script and script include it will be helpful. Attaching sample script, see if it is giving the alert message or not 

Onchange script:

RushiSavarkar_0-1740657861348.png

While creating the script include add snc_internal role to it, see if it works for you!

RushiSavarkar_1-1740657967519.png

Result: In my instance, an alert has been printed on the platform as well as on SOW.

If it helped, please accept the solution and mark it as helpful

thanks!

If my response helped you, please accept the solution and mark it as helpful.
Thank You!

@Rushi Savarkar thank you. This code is working in SOW?  

 

@Ankur Bawiskar 

 

This is my client script. 

AnnuK_1-1740728383783.png

Below is script Include

 

AnnuK_2-1740728608994.png

 

 

 

Above code works in UI but not in SOW. The script include call is not working.