Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

disabling on validate trigger on Item category table for field Parent Category

Posted on by
HI,
Please help me, with how to disable the validate trigger on the table Item 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 suggest me with right code, I need use Item category @ 3 levels
 
Best regards
Krishna
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,698 Super User 2024 Season 2 on at
    disabling on validate trigger on Item category table for field Parent Category
    Hi, You can create a new field, such as "New Parent Category";
    Then execute "Parent Category":="New Parent Category" in trigger OnValidate() of this new field, so that the value will be saved in "Parent Category", and its OnValidate Trigger will not be executed.
     
    PS: Dynamics 365 Business Central: The difference between Record.Validate() Method and assignment statement
     
    Hope this can give you some hints.
    Thanks.
    ZHU

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans