Hi Andrew,
If its clearing the value on changing its value back to Existing product. You might want to try something like this in your code. I know it is redundant to do so, but still it might perform as you expect it to programmatically rather than manually doing it.
function isproductoverridenChangedHandler(context) {
var formContext = context.getFormContext();
var isproductoverridden = formContext.getAttribute('isproductoverridden').getValue();
var productOverriddenField = formContext.getAttribute(“isproductoverridden”);
var attr_productid = formContext.getAttribute('productid');
if (isproductoverridden) {
productOverriddenField.setValue(false);
productOverriddenField.fireOnChange();
productOverriddenField.setValue(true);
}
}
Triggering fireOnChange should trigger the OOB functionality that you are experiencing when it is being set back to Existing product.
Hope it helps you to acheive what you are trying to. Please mark it verified if it did :)
Stay safe and Stay healthy!