How to run a same client script on 2 tables ? and onCHange Event
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2019 02:00 AM
Hi All,
I want to know how to run same client script for two table named as "sc_request" or "change_request" on Onchange events of same column present in both the table. Please help.
- Labels:
-
Personal Developer Instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2019 02:06 AM
1) Create the client script on the base table, i.e. TASK
2) Check the Inherited checkbox on the script
3) In the starting of the script, use the following condition to ensure that the script is running only on Incident and Catalog Task table and not on other inherited tables from the TASK table:
function onLoad() {
var table = g_form.getTableName();
if (table == 'incident' || table == 'sc_task')
{
//alert('Run my script');
//place your code here
}
}
reference:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2019 02:08 AM
Hi Harsh,
Thanks for your reply. But i want to use this on Onchange Event.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2019 02:19 AM
Hi,
Use the same script in OnChange script it will work:
var table = g_form.getTableName();
if (table == 'incident' || table == 'sc_task')
{
//alert('Run my script');
//place your code here
}
THanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2019 02:27 AM
Hi Ashutosh,
My Column is"Custom one" which is created on the child tables not on the parent table
Will it is advisable to create custom column on Task table.
Please help.