How to write the script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 02:04 AM
Hi,
I have created two variable like "Value" (single line txt variable) and "Notes"( html variable), when we fill value field less than 10000, it needs to show the Notes.
I tried with UI policy, but somehow it's not working.
Can anyone help here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 02:55 AM
Hi @PRAGHATIESH S you can use below like script
var valueLength = g_form.getValue('value').length;
if (valueLength < 10000) {
g_form.setVisible('notes', true);
} else {
g_form.setVisible('notes', false);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 02:56 AM
You need to change the field type of your first variable. A single line text field doesn't recognize '10.000' as a number so you can't query to 'less than'.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 03:23 AM
Hello @PRAGHATIESH S ,
You can try to achieve it by creating on change of "Value" catalog client script as below -
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '') {
//add the below code here if you need to evaluate condition for on load
return;
}
// Parse the value to an integer
var value = parseInt(newValue);
// Check if the value is less than 10000
if (value < 10000) {
g_form.showFieldMsg('Notes', 'Please provide additional notes.', 'info');
g_form.setDisplay('Notes', true);
} else {
g_form.setDisplay('Notes', false);
}
}
If my answer solves your issue, please mark it as Accepted ✔️& Helpful👍!