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:17 AM
Hi shilpi ,
create an onchange client script on task table and select the field , beacuse both the tables sc_request and change_request are inherited from task table so the common field present in both the tables is also present in the task table .
then check the inherited checkbox and write following script :
var table = g_form.getTableName();
if (table == 'incident' || table == 'sc_task')
{
//place your code here
}
If my reply helps you at all, I’d really appreciate it if you click the Helpful button and if my reply is the answer you were looking for, it would be awesome if you could click both the Helpful and Accepted Solution buttons!
Regards,
Apeksha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2019 02:29 AM
Hi Apeksha,
My field is custom one which is available in child table not on parent table.
can i create custom field in the parent table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2019 02:24 AM
Hi Shilpi,
you can run same client script on parent and child table such as onchange created on task can be used for incident
but if you are saying you want same client script to run on incident and knowledge then it is not possible
for scenario 1 create onchange on parent table such as task; set inherited as true so that this script runs on all child tables as well such as incident, problem and change etc
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader