Client Script to clear currency field value in Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 07:25 AM
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');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 07:33 AM
Hi,
What is the UI type of your script? If it is Desktop it will not work on Portal.
Regards,
Niklas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 07:47 AM
It is currently set to All.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 07:34 AM
Hi,
Make sure UI type is ALL on the client script
Or try to use g_form.clearValue('cost') instead of g_form.setValue('cost','NULL');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 07:48 AM
It is currently set to All, and does not work in the Portal