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

Tanushree Maiti
Kilo Patron

Refer this Servicenow Documentation. Hope it will help you.

Create catalog client scripts 

Also refer this : https://www.servicenow.com/community/technology-forum/service-bridge-client-scripts-and-variable-set...

 

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

Srikanth_9
Kilo Sage

Hi @supriyapriy,

 

Provider Side

  • Create Catalog Client Scripts are created on the Provider Instance.
  • These scripts are published with the Remote Catalog Item
  • They execute in the consumer's browser at runtime, even though the script record present on the provider instance.

All -> Service Bridge Provider -> Administration -> Remote Catalog Items

 

Consumer Side:

  • Verify it on Consumer Instance.
  • Open Service Catalog.
  • Open the Remote Catalog Item.
  • Check the script behaviour.

 

Note: You will not see the script in the consumer tables.

 

If the provided solution is useful/working, please Accept as Solution and hit the Helpful. 
 
Thanks & Regards,
Srikanth Akula.

AhsanM
Tera Expert

The key thing to understand first:

Client scripts attached to a catalog item on the provider instance do NOT automatically execute on the consumer instance. The consumer instance renders the catalog item but client side scripts need to be handled carefully.

 

Option 1: Use catalog client scripts with Service Bridge compatibility Make sure your client scripts only use standard GlideForm (g_form) API calls. Avoid any DOM manipulation or instance specific hardcoded values as these will not translate cleanly to the consumer side.

 

Option 2: Use UI Policies instead where possible UI Policies replicate more reliably across Service Bridge than client scripts. If your requirement is to show/hide or make fields mandatory, a UI Policy is a safer choice.


Important things to avoid in your client scripts for Service Bridge:

  • Do not hardcode sys_ids from the provider instance
  • Avoid GlideAjax calls that reference provider specific Script Includes unless they are also available on the consumer
  • Do not use direct DOM manipulation

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.

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