catalog client script for setting variable value

Bindhu1
Tera Contributor

Hi ,

I havea question here, there is a variable checkbox on catalog item, if box is checked, 'enter wbs code' variable field will be filled with word 'Pending'.

 

 

Bindhu1_1-1698996705930.png

below code works only in native ui when we use 'try it' but not from sp portal . please help me to resolve this.

 

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
   
if (newValue == 'true'){
	g_form.setValue('enter_wbs_code', 'pending');
}
   else{
		g_form.clearValue('enter_wbs_code');
	}
}

 

Thanks

1 ACCEPTED SOLUTION

Vishal Birajdar
Giga Sage

Hi @Bindhu1 

 

Make sure you have selected UI type as ALL on client script :

 

VishalBirajdar_0-1698997385846.png

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

View solution in original post

3 REPLIES 3

Vishal Birajdar
Giga Sage

Hi @Bindhu1 

 

Make sure you have selected UI type as ALL on client script :

 

VishalBirajdar_0-1698997385846.png

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

oops! I had forgot to change that, Thanks !

OlaN
Giga Sage
Giga Sage

Hi,

Please check and verify that you have selected to run the Catalog Client Script in both Native and Portal UI.

(UI Type == All)