on change client script for list collector

sai190
Tera Contributor

hi

My requirment is i want to display a field and it should be mandatory, i want to display a field when defects is selected in a list collector variable, but iam getting the field also when i select the other variable in the list collector? i have written on change client script but it is displaying the new field for two values where as i want to display value only when defects is selected?

kindly look into screenshots. 

the new field should not be visible while selecting incident but what happening is that if i select defects and remove defects and select incident the new field is not hiding

1 ACCEPTED SOLUTION

Hey Sai,
Did the solution worked for you?

Cheers..!
Tushar

Mark it as helpful or correct, If Applicable


Cheers..!

Happy Learning:)

Tushar

View solution in original post

12 REPLIES 12

Voona Rohila
Mega Patron
Mega Patron

Hi sai

can you share the client script.


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

hi 

 

yes please

can you share the client script which you already wrote?


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Hey Sai, 

List collector always return sys_id, but over there you are checking the new value with the display name.

  1. alert(newValue); //for checking whether we are getting the correct sys_id from the list collector
    	if(newValue == '75d20d9f87ea8110b23b4087cebb3579') {// sys_id for slected in list collector
    	g_form.setDisplay('company', true);
    	g_form.setMandatory('company', true);
    	}

Please update & check , it's working or not. If not please try the solution provided by me using system property, script include & client script

Mark it helpful & correct, If applicable

Cheers..!
Happy Learning
Tushar

Mark it as helpful or correct, If Applicable


Cheers..!

Happy Learning:)

Tushar