How to set delay in my on change client script

VIKAS MISHRA
Tera Contributor

Below is my the small part of code that i am using in my client script, could anyone please help to know that how i can place a delay there, i mean after setting the value in "category" i want to waiit for few seconds then only i should populate the sub categor.

 

basicall i have code "window.setTimeout(function, 5000)" to use for delay purpose but i do not know what i need to put in place keyword "function".

 

g_form.setValue('category',''+cat);
	               
g_form.setValue('subcategory', subCat);

 

6 REPLIES 6

Pavankumar_1
Mega Patron

Hi @VIKAS MISHRA ,

If my response helps you to resolve the issue close the question by Accepting solution and hit thumb icon. From Correct answers others will get benefited in future.
If not reply and share details.

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

Pavankumar_1
Mega Patron

Hi @VIKAS MISHRA ,

If my response helps you to resolve the issue close the question by Accepting solution and hit thumb icon. From Correct answers others will get benefited in future.
If not reply and share status of the issue.

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar