Can you Remove xClass relationship with onChange field event?

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;
var xClassRelationship = rootItem.getRelationships("Part_xClass");

if(xClassRelationship.getItemCount() > 0){
    var current = xClassRelationship.GetItemByIndex(0);

return rootItem;

  • Hi Robert

    Yes, you can remove the xClass relationship. small change to your code will work

    var rootItem = document.thisItem;

    var xClassRelationship = rootItem.getRelationships("Part_xClass");

    for (var i = 0; i < xClassRelationship.getItemCount(); i++)


    var current = xClassRelationship.getItemByIndex(i);



    Thank You

    Gopikrishnan R