Hi,
I want to disable table trigger on item category table for Parent Category
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 help me
0
Answers
{
trigger OnBeforeValidate()
begin
"Parent Category":=rec."Parent Category";
if rec.Parent<>'' then // custom field stored for parent category tempororly
"Parent Category":=rec.Parent;
end
is this bypass on validate trigger.?
Please help with code as I am not good in coding
'You can subscribe to the onbeforevalidate of the field, do wherever you want, then commit the changes, if there is any, and then error('') to stop the standard validate'