OnChange Catalog Client Script

jay1111
Kilo Guru

Hi Experts,

 

I need a help on this catalog client script. Script looks ok to me, bit it is not working on portal.

 

 

function onChange(control, oldValue, newValue, isLoading) {
	if (isLoading || newValue == '') {
		return;
	}
		if(g_form.getValue('account') == 'Service Account'){
		g_form.setVisible('service_account_link', true);
		g_form.setReadonly('service_account_link', true);
		alert('Service Account');
		
	}
}

 

 

I want to add more conditions to the if condition like. 

 

 

 if((g_form.getValue('account') == 'Service Account') || (g_form.getValue('account') contains 'offshore') ||(g_form.getValue('account') startwith 'billing'))

 

 

Thanks,

Jay

 

 

1 ACCEPTED SOLUTION

Hi @jay1111 ,

You can use in built Javascript methods like startsWith() and includes().

 

var str = g_form.getDisplayValue("account");
if(str.startsWith("billing") || str.includes("offshore")){
alert("Service Account");
}

Get display value of reference field

 

View solution in original post

10 REPLIES 10

Use UI policy where you can easily set these conditions.