- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2026 09:56 AM
Hi @khareakshay ,
Your g_form.clearValue() syntax is correct. The issue is most likely with the Select Box variable configuration rather than clearValue() itself.
For a Select Box variable, first check whether the variable allows an empty value.
Recommended approach:
1. Open the changes_entity_appointment_ownership variable.
2. Make sure "Include none" is enabled.
3. Make sure there is no Default value configured.
4. Check that another Catalog Client Script or Catalog UI Policy is not setting the value again.
Then this should be sufficient:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
g_form.clearValue('entity_name');
g_form.clearValue('changes_entity_appointment_ownership');
}
The important point is that clearValue() clears the selected value; it does not remove the choices from the Select Box.
If the Select Box does not have an empty/None option, the control may continue to display a selectable value instead of remaining blank.
Do not use clearOptions() just to reset the selected value, because clearOptions() removes the available choices themselves.
If the choices are being generated dynamically and you intentionally use clearOptions(), add the blank option back before adding the valid choices:
g_form.clearOptions('changes_entity_appointment_ownership');
g_form.addOption('changes_entity_appointment_ownership', '', '-- None --');
Then add the required choices.
Regarding appointments:
Since appointments is an MRVS, treat it separately. If the requirement is to remove all MRVS rows, you can reset the MRVS value using an empty JSON array:
g_form.setValue('appointments', JSON.stringify([]));
So I would test the Select Box first with "Include none" enabled. If it still does not clear, check the browser console and verify whether another Catalog Client Script/UI Policy is repopulating that variable immediately after this script executes.
Hope this helps!
If this response helped, please mark it as Helpful.
If it resolves your issue, please Accept it as Solution.
Kind Regards,
Abhishek Pal