use of gs.include()

C_30
Kilo Contributor

use of gs.include()

1 ACCEPTED SOLUTION

kushal Tayade
Mega Guru

 

You can call another script include using gs.include('script include name'). Then you have access to functions present inside that script include.  This is to avoid unnecessary duplication of code.

 

Thanks,

Kushal

View solution in original post

4 REPLIES 4

ARG645
Tera Guru
gs.include() allows you to call a script include and use the functions in that script include within your current script include i.e you do not have to copy the functions into your current script include, but rather you can call them directly. https://community.servicenow.com/community?id=community_question&sys_id=bc7b8f21db9cdbc01dcaf3231f96196a

Hello Aman, 

Still i did not understand that how it is different from initializing Script Includes ? Can you please explain the use of gs.include(), using a simple example.

I see below in one of the BR; did not get if what difference the first line made here:

gs.include("DeliveryPlan");
var plan = new DeliveryPlan(current);
plan.initTasks();

Thanks,

Rahul

 

SaiRaviKiran Ak
Giga Guru

Hi,

gs.include() allows you to call a script include and use the functions within that script include. This means that you do not have to copy the functions into your current script include, but rather than call them directly.

 Search through the script include and see if there are functions that are called which are not exist in the current script include. Then go to the script include which is called with gs.include() method to see what it is doing.

 

Check below thread also:

gs.include()

 

Mark Correct  if it answers your question.

Thanks,

Ravi

kushal Tayade
Mega Guru

 

You can call another script include using gs.include('script include name'). Then you have access to functions present inside that script include.  This is to avoid unnecessary duplication of code.

 

Thanks,

Kushal