- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2017 04:18 AM
Hi
I have 2 pages that have data from one table in the DB.
I want to write client script for the 2 pages.
Can i write 1 client script for the 2 pages ? or to write the same script include twice ?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2017 06:05 AM
Script includes are for server side code libraries. UI scripts are the client side counterpart. You need to use a UI script to store your common code that you call from the various client scripts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2017 05:52 AM
Hi Abed,
You can write a client script on the table that is being referenced by these other pages and and if you tick the 'Inherited' box it will apply that script for all extended tables.
For example, i have a client script ensuring correct formatting on the IP address field on the cmdb_ci table, this is inherited by all tables extending cmdb_ci so i don't have to replicate the script for all CI classes using that field.
It depends on what your requirements are but this might be something you can use, just remember that this will apply to all extended tables so be sure this won't cause unexpected consequences elsewhere!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2017 05:57 AM
Better option would be :
You can write the same client script on the client script section of the ui pages and make a common repository of code in the Script Include to access the table data.Call the script include there in the client scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2017 06:00 AM
how can i make common repository ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2017 06:01 AM
Short answer: UI Scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2017 06:03 AM
By common repository I mean Script Includes that holds the reusable codes.