Catalog item onchange script

Luis Roman
Kilo Guru

I am a newbie in scripting. I have the following onChange script in a catalog item. I need that when company field change then s_u_program and s_u_lob  content is clear so that the content of those fields is clear (no values). The script below is not working or is not executed or the values are not clear. Therefore, your expert advise to help me correct this issue will be appreciated. 

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
g_form.clearValue('s_u_program');
g_form.clearValue('s_u_lob');
g_form.addErrorMessage('Onchange Script');
}

Fig. 1 find_real_file.png

@Luis Roman 

1 ACCEPTED SOLUTION

Shakeel Shaik
Giga Sage
Giga Sage

Hi @Luis Roman 

 

If you are testing through Service Portal, Then you need to change the UI Type to All.

find_real_file.png

 

Please check and let us know.

Thanks 🙂

Thanks,
Shakeel Shaik 🙂

View solution in original post

2 REPLIES 2

SanjivMeher
Kilo Patron
Kilo Patron

Can you set UI type to All and try below script 

 

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
g_form.setValue('s_u_program','');
g_form.setValue('s_u_lob','');
alert('Onchange Script');
}


Please mark this response as correct or helpful if it assisted you with your question.

Shakeel Shaik
Giga Sage
Giga Sage

Hi @Luis Roman 

 

If you are testing through Service Portal, Then you need to change the UI Type to All.

find_real_file.png

 

Please check and let us know.

Thanks 🙂

Thanks,
Shakeel Shaik 🙂