How to run a same script on 2 tables ?

AbdulAzeez
Mega Guru

Hello Everyone,

I have a client script which i wanted to run on 2 tables like Incident & task table ?

How can i achieve this ?

1 ACCEPTED SOLUTION

Hi Abdul,



The Inherited functionality, alone, on a client script would be useful only if you would want that script to run all the extended tables of a base table.



However, since in your case, you want the script to run only on Incident and Catalog Task table, you can do the following:




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


                  }


}




This should work and will make this script run on only the Incident and the Catalog Task tables extended from Task. Let me know if it doesn't.



PS: Mark this answer as Correct if it solved your query or hit Like/Helpful depending upon the usefulness of the response.



Regards


Supriya Bisht


View solution in original post

18 REPLIES 18

Harsh Vardhan
Giga Patron

Can you please tell me what exactly you want to achieve?


I have a requirement for which i written a client script which is working fine that wrote on Incident table, i want the same functionality to run on Catalog task table too, so can i make a script dynamic to run on 2 tables ?>


sb1186
Kilo Guru

Hi Abdul,



If one of these two table is an extended of the other table, like task and incident, if you create a script on the parent table, you can check the checkbox Inherited on the client script to execute it on the Incident table as well.


find_real_file.png



PS: Mark this answer as Correct if it solved your query or hit Like/Helpful depending upon the usefulness of the response.



Regards
Supriya Bisht


Hello Supriya,



Yes both the tables are extended from Task table i.e; Incident & Catalog task table, i can see inherited option on Client script which is checked in by default, can you please be lil more specific how to the run same script on 2 tables ?