Hello,
I’ve created a Javascript web resource to filter an option set using this article as a guide: https://neilparkhurst.com/2015/12/01/javascript-control-optionset-values/
I want to be able to filter the Opportunity Type (option set) field based on what is selected in the Owning Team (Text) field. However, I keep receiving the following error when I try to run it:

Below is my code. How can I fix this error so the code successfully filters the Opportunity Type?
var analytics = {value : 701, text : "Analytics"};
var auto = {value : 100000000, text : "Automation / IAC"};
var burwood = {value : 801, text : "Burwood Cloud & Managed Svcs"};
var healthcare = {value : 401, text : "Healthcare Advisory Services"};
function FilterOppType(all) {
var pickList = Xrm.Page.getControl("new_opportunitytype");
var options = Xrm.Page.getAttribute("new_opportunitytype").getOptions();
var owningteam = Xrm.Page.getAttribute("new_owningteamtext");
// *** Clear current items
for (var i = 0; i < options.length; i++) {
pickList.removeOption(options[i].value);
}
// *** Now add back just what is needed
if (owningteam == "Healthcare") {
pickList.addOption(healthcare);
}
pickList.addOption(analytics);
pickList.addOption(auto);
pickList.addOption(burwood);
}