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

what is the use of isLoading, isTemplate in onChange client script

Nagaraj Bhatkal
Kilo Contributor

what is the use of isLoading, isTemplate in onChange client script

4 REPLIES 4

Michael Fry1
Kilo Patron

Since an OnChange Client script can run onChange and onLoad, using isLoading will prevent it from running onLoad.

 

isTemplate can be used to control whether or not the client script runs after a Template is used.

 

https://docs.servicenow.com/bundle/kingston-application-development/page/script/client-scripts/conce...

Priyanka136
Mega Guru

Hi Nagaraj Bhatkal,

1) isLoading - Identifies whether the changes occurs as a part of form load.Value is true if changes is due to a form load.

2) isTemplate - Identifies whether the changes occurs as part of template load. Value is true if changes is due to population from a template.

Refer this link also:-
https://developer.servicenow.com/app.do#!/lp/new_to_servicenow/app_store_learnv2_scripting_kingston_...

https://docs.servicenow.com/bundle/london-application-development/page/script/client-scripts/concept...

Let me know if you have any questions.

Please mark it Correct or Helpful, if it works based on impact....!!!!

Warm Regards,

Priyanka

find_real_file.png

www.dxsherpa.com

 

 

 

Aishwarya Puri
Giga Expert

Hi Nagaraj,

 

In onChange Client Script script

 

isLoading - it works at the time of form loading or we can say that when form opens it takes 2 seconds to 3 seconds loads all the contains properly so, at this time of loading if any changes happens at that field in which onchange client script is written it neglect that changes or it didn't consider that changes.

 

isTemplate - it checks whether the values populated through applied template is correct or not.

 

And check out below link to understand this in a better way:

https://developer.servicenow.com/app.do#!/lp/new_to_servicenow/app_store_learnv2_scripting_kingston_the_script_field?v=kingston

 

Warm Regards, 

Aishwarya Puri

Chandru4
Kilo Expert

Excerpt from Servicenow Developer Articles:

  • isLoading: boolean value indicating whether the change is occurring as part of a form load. Value is true if change is due to a form load. When forms load, all the field values on the form change as the record is loaded into the form.
  • isTemplate: boolean value indicating whether the change occurred due to population of the field by a template. Value is true if change is due to population from a template.