Calling script Include from UI Script

pavan_yakkala
Kilo Contributor

Hello,

I have a requirement to call Script Include from UI Script as below

From UI Script : 1) Finding an event as load of List layout as below

        if(String(document.location).indexOf('core_company_list.do) > -1&& String(document.location).indexOf('sysparm_view=selectcompany') > -1){

}

If this condition is true,   i have to call a Script Include by passing a parameter to script Include where my script include validates with this parameter and decides the screen redirection based on validation.

Script Include :   It contains simple function which returns array of values based on validation of parameter passed.

I have to use this Script Include for list filter like javascript:scriptIncludeName();

This is for filtering list layout and redirection based on script return values as i have to pass a parameter on load.

can any one please help me.

Thanks,

Pavan.

5 REPLIES 5

Mike Allen
Mega Sage

You are going to have to use GlideAjax to do call a script include from a UI Script.


manish_vinayak
Kilo Expert

Hi Pavan,



You should make that script include client callable and use GlideAjax to call that function.


Please refer http://wiki.servicenow.com/index.php?title=GlideAjax



Hope that helps.



Thanks,


Manish


Hi Manish,



Thanks for your reply.



Here I have to use same Script Include function to filter list layout( like i have to call this function in query condition also like below sysparm_query=nameINjavascript:ListofCompaniesbasedonDomain()



if i make this as Ajax callable function i am unable to call this function   like specified above while filtering list



so Making my script Include as Ajax callable is not helping me out.



Can you please share your ideas on this.



Thanks,


Pavan.


Chandan23
Tera Expert


Hi Pavan,



If you want to do so, please make a global business rule with client callable true.


That will work for you.