The CreatorCon Call for Content is officially open! Get started here.

Client Script to clear currency field value in Service Portal

Nichole L
Tera Contributor

I have a currency field where, if the amount exceeds $1000, it should clear the value and displays a field message.  My onChange client script (see below) includes the following lines and works fine in the UI, but the field value does not clear in the Service Portal.  Any thoughts/ideas?

 

if(g_form.getValue('cost') > 'USD;1000.00') {

g_form.setValue('cost','NULL');

g_form.showFieldMsg('cost', 'Cost cannot exceed $1000', 'warning');

 

 

 

6 REPLIES 6

Niklas Peterson
Mega Sage

Hi,

What is the UI type of your script? If it is Desktop it will not work on Portal.

NiklasPeterson_0-1694615584858.png

 

Regards,
Niklas

It is currently set to All.

Shruti
Mega Sage
Mega Sage

Hi,

Make sure UI type is ALL on the client script

Shruti_0-1694615563523.png

Or try to use g_form.clearValue('cost') instead of g_form.setValue('cost','NULL');

It is currently set to All, and does not work in the Portal