Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

need solution in client script

keval3
Tera Contributor

Hi All,

I have below requirement

I have wright one on change client script on choice field called purchasing group when choice of purchasing group will change at that time user list will remove. for that I have written  below client script 

g_form.clearValue('user_list'); 
this client script is removing value from user list but I don't want remove it. it should stay when I change the value.
kindly let me know how to do it.

 

keval3_0-1722513149871.png

 

 

Thanks & Regards

KP

4 REPLIES 4

Anurag Tripathi
Mega Patron
Mega Patron

I'm sorry can you elaborate?

If you don't want the value cleared then remove 

g_form.clearValue('user_list'); 
-Anurag

Hi Anurag,

See in the choice field there are 3 option for ex: A,B,C when I Choose A at that time in user list field I am choosing 2 to 3 users and save the form after that I open same form again and select option B and again choose other 2 to 5 user from user list again save the form after that when I reopen the form and again select option A at that time previously selected user should be their as it is. right now it is removing the user. kindly let me know how to do it.

Krushna R Birla
Kilo Sage

Hi @keval3 

 

If you want that user list value to be there, then you need to remove that g_form.clearValue('user_list'); line from your on change script.

 

If your requirement is different, let me know what you want to achieve so that I can help you.

 

If this solution resolves your query, kindly mark it as the accepted solution and give it a thumbs up.

 

Best Regards,
Krushna Birla

Hi Krushna,

Hi Anurag,

See in the choice field there are 3 option for ex: A,B,C when I Choose A at that time in user list field I am choosing 2 to 3 users and save the form after that I open same form again and select option B and again choose other 2 to 5 user from user list again save the form after that when I reopen the form and again select option A at that time previously selected user should be their as it is. right now it is removing the user. kindly let me know how to do it.