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

Clear variable value on an onLoad Client Script

rachelconstanti
Mega Sage

How do I clear a variable value using an onLoad Client Script?

 

The catalog item auto fills a variable (employee type) based on the requested for.   Requested for auto fills when the submitter opens the catalog item.

 

Using an onChange script, the employee type does not populate unless the requested for is changed.

Using an onLoad script, the employee type populates but if I change the 'requested for' the employee type does not change.

 

What can I do to get this to populate correctly?  

 

Thank you for any help you can offer...

1 ACCEPTED SOLUTION

Use the onchange client script and remove the isloading check on it.

-Anurag

View solution in original post

16 REPLIES 16

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @rachelconstanti 

 

use Auto Populate feature and populate the rest 3 variable based on same. and it will do work for you

LearnNGrowAtul_0-1704461096569.png

 

LearnNGrowAtul_1-1704461096560.png

 

https://www.servicenow.com/community/developer-forum/refresh-portal-fields-on-change-of-requested-fo...

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Thank you for the response.  Unfortunately, we are still on the Tokyo release and this is an immediate need.

Share your code here mate. Experts will check and help you.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Code has been shared...

Hopefully someone has a solution