Delete item from BOM

Hi,   I created a new method that transfers a item from one BOM to another. The adding to a new BOM works fine, its the deleting from the old BOM is where I'm having a problem. I'm getting "Aras.Server.Core.MissingCriteriaException" error.  with the following details: Aras.Server.Core.MissingCriteriaException " type =" Aras.Server.Core.MissingCriteriaException " /> Method below   // *** Delete transfer components in old BOM Item TDC_BOM = this.newItem("MIN_TDC_Delivered_BOM","get"); TDC_BOM.setProperty("source_id",myTDC.getID()); TDC_BOM = TDC_BOM.apply(); List<string> TDCIds = new List<string>(); for (int j=0 ; j<TDC_BOM.getItemCount() ; j++){ Item deleteComponentBom = this.newItem("MIN_System_BOM","delete"); deleteComponentBom.setProperty("related_id",TDC_BOM.getItemByIndex(j).getRelatedItemID()); deleteComponentBom.apply(); }
Parents
  • Hi Dominic, Delete and Update actions require either an ID as attribute or a where clause. I'm not checking the whole code, but for the specific error you see, you should rewrite the deletion part with the following:
    Item deleteComponentBom = this.newItem(“MIN_System_BOM”,”delete”);
    deleteComponentBom.setAttribute(“where”,"[MIN_System_BOM].related_id = '"+TDC_BOM.getItemByIndex(j).getRelatedItemID()+"'");
    deleteComponentBom.apply();
    
    
    
Reply
  • Hi Dominic, Delete and Update actions require either an ID as attribute or a where clause. I'm not checking the whole code, but for the specific error you see, you should rewrite the deletion part with the following:
    Item deleteComponentBom = this.newItem(“MIN_System_BOM”,”delete”);
    deleteComponentBom.setAttribute(“where”,"[MIN_System_BOM].related_id = '"+TDC_BOM.getItemByIndex(j).getRelatedItemID()+"'");
    deleteComponentBom.apply();
    
    
    
Children
No Data