Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Catalog client script in service bridge

supriyapriy
Tera Contributor

How to create and publish catalog client script in service bridge . 

Need help to know How to create catalog client script and that to be works on consumer instance side?

1 ACCEPTED SOLUTION

AhsanM
Tera Expert

Thanks for sharing the error screenshot, that is really helpful context. Let me address each point:

 

1. What copies over to the consumer instance via Service Bridge

Based on experience, here is what typically flows through and what does not:

What copies over:

  • Catalog item definition
  • Variables and variable sets
  • UI Policies
  • Catalog client scripts (with remote script approval)

What does NOT automatically copy over:

  • Script Includes (including client callable ones)
  • Any server side dependencies the catalog item relies on

This is the root cause of your GlideAjax errors in the screenshot. The client script on the consumer is trying to call a Script Include that only exists on the provider instance, hence the 404 and unhandled exception in GlideAjax errors.


2. How to sync Script Includes from provider to consumer

Unfortunately there is no automatic sync mechanism for Script Includes via Service Bridge. The current approach is manual:

  • Export the Script Include from the provider instance as an update set
  • Import and commit it on the consumer instance
  • This needs to be repeated whenever the Script Include is updated on the provider

3. The /xmlhttp.do 404 error

This confirms the Script Include is missing on the consumer. Since you already manually added it and it is working, that validates the diagnosis. Going forward maintain a separate update set on the provider specifically for Script Includes used by Service Bridge catalog items so they can be easily exported and applied to consumer instances.

 

Hope this helps clarify the behavior!

Ahsan
ServiceNow Developer & Admin
Builder of NowFixer | Free AI debugging tool for ServiceNow scripts

View solution in original post

9 REPLIES 9

devjorginho
Giga Contributor

Hi supriyapriy, i suggest this course: Scripiting in ServiceNow Fundamentals.
here you can find a lot of info about scripts. is very didactic.

supriyapriy
Tera Contributor

Created catalog client script and published and on consumer instance. On consumer Instance side Remote script approval is selected and mark it as approved but still client script is not working

 

AhsanM
Tera Expert

Thanks for the update. Here are a few things to check:

 

1. Verify the script is actually being delivered to the consumer

On the consumer instance go to Service Catalog > Catalog Client Scripts and check if the script appears there after approval. If it does not appear, the replication may not have completed properly. Try revoking and re-approving the remote script.

 

2. Check the UI Type setting

Make sure the UI Type on your client script is set to "All" or matches the portal/interface the consumer is using. If the consumer is using Service Portal and your script is set to Desktop only, it will not fire.

 

3. Check the script type and trigger condition

If it is an onChange script, verify the field name it is watching exists on the consumer instance side with the exact same name. If the field name differs even slightly the script will not trigger.

 

4. Check browser console for errors

On the consumer instance, open the browser developer tools (F12) and check the Console tab for any JavaScript errors when the form loads. This will tell you if the script is loading but failing silently.

 

5. Verify catalog item association

On the consumer instance confirm the client script is associated with the correct catalog item. Sometimes after replication the catalog item reference can point to a different sys_id than expected.

 

Can you share what type of client script it is (onLoad, onChange, onSubmit) and what it is supposed to do? That will help narrow down the issue further.

Ahsan
ServiceNow Developer & Admin
Builder of NowFixer | Free AI debugging tool for ServiceNow scripts

supriyapriy
Tera Contributor

While configuring service bridge, we face the below challenges.

Does the client script, variable sets and client callable script includes copy over to the consumer instance ? We don't see them flowing through. 

Are there any documentation around, list of tables config that gets copied over to the remote record producer.

As I Checked with Error and manually add the script include in consumer instance and is working now.
But How to Sync the script include from provider to consumer isntance?


AhsanM
Tera Expert

Thanks for sharing the error screenshot, that is really helpful context. Let me address each point:

 

1. What copies over to the consumer instance via Service Bridge

Based on experience, here is what typically flows through and what does not:

What copies over:

  • Catalog item definition
  • Variables and variable sets
  • UI Policies
  • Catalog client scripts (with remote script approval)

What does NOT automatically copy over:

  • Script Includes (including client callable ones)
  • Any server side dependencies the catalog item relies on

This is the root cause of your GlideAjax errors in the screenshot. The client script on the consumer is trying to call a Script Include that only exists on the provider instance, hence the 404 and unhandled exception in GlideAjax errors.


2. How to sync Script Includes from provider to consumer

Unfortunately there is no automatic sync mechanism for Script Includes via Service Bridge. The current approach is manual:

  • Export the Script Include from the provider instance as an update set
  • Import and commit it on the consumer instance
  • This needs to be repeated whenever the Script Include is updated on the provider

3. The /xmlhttp.do 404 error

This confirms the Script Include is missing on the consumer. Since you already manually added it and it is working, that validates the diagnosis. Going forward maintain a separate update set on the provider specifically for Script Includes used by Service Bridge catalog items so they can be easily exported and applied to consumer instances.

 

Hope this helps clarify the behavior!

Ahsan
ServiceNow Developer & Admin
Builder of NowFixer | Free AI debugging tool for ServiceNow scripts