field(2; "Parent Category"; Code[20])
{
Caption = 'Parent Category';
TableRelation = "Item Category";
trigger OnValidate()
var
ItemCategory: Record "Item Category";
ItemAttributeManagement: Codeunit "Item Attribute Management";
ParentCategory: Code[20];
begin
ParentCategory := "Parent Category";
while ItemCategory.Get(ParentCategory) do begin
if ItemCategory.Code = Code then
Error(CyclicInheritanceErr);
ParentCategory := ItemCategory."Parent Category";
end;
if "Parent Category" <> xRec."Parent Category" then
ItemAttributeManagement.UpdateCategoryAttributesAfterChangingParentCategory(Code, "Parent Category", xRec."Parent Category");
end;
}
---------------------
Please suggest me with right code, I need use Item category @ 3 levels
Best regards
Krishna