I'm trying to clear out the xClass relationship when the class of a part is changed. The code I have below is ran on the filed event of the drop down onChange, however it doesn't remove the xClass relationship.
var rootItem = document.thisItem;
rootItem.fetchRelationships("Part_xClass");
var xClassRelationship = rootItem.getRelationships("Part_xClass");
if(xClassRelationship.getItemCount() > 0){
var current = xClassRelationship.GetItemByIndex(0);
rootItem.removeRelationship(current);
}
return rootItem;