On change Scripting Help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
I have 2 variable that influences another variable. Lets call the first variable tomato. Tomato is a yes or no variable type and is set to mandatory and defaulted to none when the catalog request form loads.
The second variable, let's call it bread, is a variable set with a single muti choice variable we'll call slice with four choices. Slice is set to mandatory and has do not select the first choice checked.
The third variable, let's call it lettuce, is a reference type variable.
When slice is set to change and tomato is set to no, lettuce should be defaulted to mandatory. If a user changes tomato to yes, then then lettuce should not be mandatory. This works, but when user change tomato from no to yes, and then to no again, lettuce does not go back to being mandatory.
I know that I need an on-change client catalog script, but I'm unsure how to go about it. Any help would be appreciated.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
8m ago
I suggest you to use Catalog UI Policy
UI Policy 1:
Condition: Slice = Change and Tomato = no
UI Policy Action
Lettuce to Mandatory=true (Checked)
If tomato = yes then above UI Policy condition fails so Lettuce will be set to non mandatory automatically
Palani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5m ago
Hi @SusanSchwar
onChange script for tomato
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) return;
var slice = g_form.getValue('slice');
// Check if slice is selected and tomato is "no"
if (slice && newValue == 'no') {
g_form.setMandatory('lettuce', true);
} else {
g_form.setMandatory('lettuce', false);
}
}
onChange script for slice
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) return;
var tomato = g_form.getValue('tomato');
// Check if slice is selected and tomato is "no"
if (newValue && tomato == 'no') {
g_form.setMandatory('lettuce', true);
} else {
g_form.setMandatory('lettuce', false);
}
}
Thanks,
Vignesh
"If this solution resolves your issue, kindly mark it as correct."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
23 seconds ago
Or You can also use UI Policy
UI Policy 1: Make lettuce mandatory
Condition:
tomato is No
AND slice is not empty
Actions:
Set lettuce to mandatory = true
Check:
✅ Run on Load (so it applies on form load too)
UI Policy 2: Make lettuce not mandatory
Condition:
tomato is Yes
Actions:
Set lettuce to mandatory = false
Check:
✅ Run on Load