Catalog client script

Bheemaraju Vagu
Tera Expert

I have one Variable in catalog item

Case 1:

 

   BheemarajuVagu_0-1704808297195.png

If i select Yes 

I need to populate the another variable

BheemarajuVagu_1-1704808410069.png

 

Case 2:

If I select "No"

Another variable should come.

 

Can some one please provide me the Catalog client script ?

 

 

 

11 REPLIES 11

@Bheemaraju Vagu 

you can simply use newValue to compare rather than using g_form.getValue

Also if value is yes then you want to auto-populate then you should use g_form.setValue()

try this and use correct variable name

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
	if (isLoading) {
		return;
	}

	if (newValue == "yes") {
		g_form.setValue('variableName', 'Your Text');
	} else {
		g_form.setDisplay('u_removed', true);
	}
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Bheemaraju Vagu 

 

Agree with @Ankur Bawiskar  & @Anurag Tripathi , so just giving you path

 

LearnNGrowAtul_0-1704811105295.png

 

 

Check this OOTB UI policy and you wil get idea.

*************************************************************************************************************
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]

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