The CreatorCon Call for Content is officially open! Get started here.

What does "gs.include("PrototypeServer")" do in a script include?

jamesgo
Giga Contributor

For e.g, in script include "CatalogTransactionOrder".

4 REPLIES 4

eican
Kilo Guru

Well, it includes the script include with that very same name.


jamesgo
Giga Contributor

Sorry I think I was trying to ask what does the script PrototypeServer do? when and why do you need to include it?


ccajohnson
Kilo Sage

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



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



I hope this is helpful,


andrew_kincaid
ServiceNow Employee
ServiceNow Employee

A long, long time ago, in order to create your own "Class" in a Script Include, you had to import the "PrototypeServer" Script Include using the gs.include("PrototypeServer"); call.   Starting with the Fall 2009 Stable 1 build (Oct 2009), the same code that is in PrototypeServer that defines the "Class" prototype is loaded automatically.   You no longer need to include PrototypeServer in order to use "new Class()".   I suspect the "PrototypeServer" Script Include is kept in the out-of-the-box code so that any existing calls to gs.include("PrototypeServer") do not generate errors.