Item template detail will be deleted if the item is deleted


If the original item in the Inventory Table is deleted,  then the records in the tables, with itemID field, will also be deleted. Since this is a general issue for the record templates feature in Ax, and is caused by the fact that deleting templates is not supported, SE’s recommendation for solving this issue is as below.


 


This fix is applied in \Classes\SysRecordTemplate:initValue().


 


Change:


 


    if (common.TableId == tablenum(EventRuleData))


        excludeValidateField.add(fieldId2Ext(fieldnum(EventRuleData,RuleId),1));


 


To:


    switch(common.TableId)


    {


        case tablenum(EventRuleData):


            excludeValidateField.add(fieldId2Ext(fieldnum(EventRuleData,RuleId),1));


            break;


        case tablenum(InventTableModule):


            excludeValidateField.add(fieldId2Ext(fieldnum(InventTableModule,ItemID),1));


            break;


        case tablenum(InventItemLocation):


            excludeValidateField.add(fieldId2Ext(fieldnum(InventItemLocation,ItemID),1));


            break;


}


Comments (1)

  1. Amber says:

    What does this "fix" do exactly? How does it "solve the issue"? Does it keep it from deleting the template detail? Or does it allow you to delete the template? Or does it keep you from deleting the item?