delete xclass available on part through code

Hi everyone,

i want to delete xclass available on part through client side action on part itemtype.

we can delete it through delete button available in xclass html on Part form, but i want to delete it through client side action on part.

  • Hi 

    Create New Method and copy paste below Javascript code

    var parentType = parent.item.getAttribute('type');
    var xClassName = parentType + '_xClass';
    var deleteItem = aras.newIOMItem(xClassName, 'get');
    deleteItem.setAttribute('select', 'related_id(label)');
    deleteItem.setProperty("source_id", this.getID());
    deleteItem = deleteItem.apply();
    for (i = 0; i < deleteItem.GetItemCount(); i++)
    {
    var xClassRel = deleteItem.getItemByIndex(i);
    xClassRel.setAttribute("version","0");
    xClassRel.apply("delete");
    }

    Navigate to Administration --> Action

    Create New action (Type = Item and Action = Client and Method = above created method)

    Open Part Item type and add this action under Actions tab

    Save and Unlock

    Open any part and under actions you will see the newly created action

    Reopen item to view the changes

    Thank You

    Gopikrishnan R

  • Thanks Gopikrishan for your reply.