Page 20405 Qlty. Inspection Gen. Rules

Quality Management, Microsoft.QualityManagement.Configuration.GenerationRule

src/Apps/W1/Quality Management/app/src/Configuration/GenerationRule/QltyInspectionGenRules.Page.al719 lines, Copyright (c) Microsoft Corporation. MIT

// ------------------------------------------------------------------------------------------------// Copyright (c) Microsoft Corporation. All rights reserved.// Licensed under the MIT License. See License.txt in the project root for license information.// ------------------------------------------------------------------------------------------------namespace Microsoft.QualityManagement.Configuration.GenerationRule;using Microsoft.QualityManagement.Configuration.GenerationRule.JobQueue;using Microsoft.QualityManagement.Integration.Manufacturing;using Microsoft.QualityManagement.Integration.Receiving;using Microsoft.QualityManagement.Integration.Warehouse;using Microsoft.QualityManagement.Setup;using Microsoft.QualityManagement.Telemetry;page 20405 "Qlty. Inspection Gen. Rules"{    Caption = 'Quality Inspection Generation Rules';    DataCaptionExpression = GetDataCaptionExpression();    DelayedInsert = true;    PageType = List;    SourceTable = "Qlty. Inspection Gen. Rule";    PopulateAllFields = true;    SourceTableView = sorting("Sort Order", Intent);    AccessByPermission = tabledata "Qlty. Inspection Gen. Rule" = R;    UsageCategory = Lists;    ApplicationArea = QualityManagement;    AboutTitle = 'About Quality Inspection Generation Rules';    AboutText = 'Use inspection generation rules to control when quality inspections are created. You can define the business context, such as receiving, production, or warehouse activities, and specify which inspection template applies.';    layout    {        area(Content)        {            repeater(Repeater)            {                ShowCaption = false;                field("Sort Order"; Rec."Sort Order")                {                    Visible = ShowSortAndTemplate;                }                field("Template Code"; Rec."Template Code")                {                    Visible = ShowSortAndTemplate;                    ShowMandatory = true;                }                field(Description; Rec.Description)                {                }                field(Intent; Rec.Intent)                {                }                field("Source Table No."; Rec."Source Table No.")                {                    Visible = false;                }                field("Table Caption"; Rec."Table Caption")                {                    AssistEdit = true;                    ToolTip = 'Specifies the table for this rule. For example for receiving to a Purchase Line, you would use table 39. For production typically 5409 for Production Order Routing Line.';                    AboutTitle = 'The table for this rule';                    AboutText = 'Here you select a table for which you want to create an inspection. For example, for receiving to a purchase line, you would use table 39. You then set criteria using a table filter to control when the rule applies. When the filter criteria are met, the template is selected. If multiple templates match, the first one found by sort order is used.';                    trigger OnAssistEdit()                    begin                        Rec.HandleOnAssistEditSourceTable();                        if Rec."Source Table No." <> 0 then                            CurrPage.SaveRecord();                        if xRec."Entry No." = Rec."Entry No." then                            CurrPage.Update(true);                    end;                }                field("Condition Filter"; Rec."Condition Filter")                {                    trigger OnAssistEdit()                    begin                        Rec.AssistEditConditionTableFilter();                        Rec.SetIntentAndDefaultTriggerValuesFromSetup();                        if xRec."Entry No." = Rec."Entry No." then                            CurrPage.Update(true);                    end;                }                field("Item Filter"; Rec."Item Filter")                {                    trigger OnAssistEdit()                    begin                        Rec.AssistEditConditionItemFilter();                    end;                }                field("Item Attribute Filter"; Rec."Item Attribute Filter")                {                    trigger OnAssistEdit()                    begin                        Rec.AssistEditConditionAttributeFilter();                    end;                }                field("Activation Trigger"; Rec."Activation Trigger")                {                    AboutTitle = 'Activation trigger';                    AboutText = 'Use the activation trigger to control when inspections are created automatically. For each business intent, you define the event that triggers the inspection to start, such as posting a purchase receipt.';                }                field("Assembly Trigger"; Rec."Assembly Trigger")                {                    Visible = ShowAssemblyTrigger;                    Editable = EditAssemblyTrigger;                    StyleExpr = AssemblyStyle;                }                field("Production Order Trigger"; Rec."Production Order Trigger")                {                    Visible = ShowProductionTrigger;                    Editable = EditProductionTrigger;                    StyleExpr = ProductionStyle;                }                field("Purchase Order Trigger"; Rec."Purchase Order Trigger")                {                    Visible = ShowPurchaseTrigger;                    Editable = EditPurchaseTrigger;                    StyleExpr = PurchaseStyle;                }                field("Sales Return Trigger"; Rec."Sales Return Trigger")                {                    Visible = ShowSalesReturnTrigger;                    Editable = EditSalesReturnTrigger;                    StyleExpr = SalesReturnStyle;                }                field("Transfer Order Trigger"; Rec."Transfer Order Trigger")                {                    Visible = ShowTransferTrigger;                    Editable = EditTransferTrigger;                    StyleExpr = TransferStyle;                }                field("Warehouse Receipt Trigger"; Rec."Warehouse Receipt Trigger")                {                    Visible = ShowWarehouseReceiveTrigger;                    Editable = EditWarehouseReceiveTrigger;                    StyleExpr = WhseReceiveStyle;                }                field("Warehouse Movement Trigger"; Rec."Warehouse Movement Trigger")                {                    Visible = ShowWarehouseMovementTrigger;                    Editable = EditWarehouseMovementTrigger;                    StyleExpr = WhseMovementStyle;                }                field("Schedule Group"; Rec."Schedule Group")                {                    trigger OnDrillDown()                    var                        QltyJobQueueManagement: Codeunit "Qlty. Job Queue Management";                    begin                        QltyJobQueueManagement.CheckIfGenerationRuleCanBeScheduled(Rec);                        if GuiAllowed() then                            if Rec."Schedule Group" = '' then begin                                Rec."Schedule Group" := DefaultScheduleGroupLbl;                                Rec.Modify(false);                                if not QltyJobQueueManagement.PromptCreateJobQueueEntryIfMissing(Rec."Schedule Group") then begin                                    Rec."Schedule Group" := '';                                    Rec.Modify(false);                                end                            end else                                QltyJobQueueManagement.RunPageLookupJobQueueEntriesForScheduleGroup(Rec."Schedule Group")                    end;                }            }        }        area(FactBoxes)        {            systempart(RecordLinks; Links)            {                ApplicationArea = RecordLinks;                Visible = false;            }            systempart(RecordNotes; Notes)            {                ApplicationArea = Notes;                Visible = false;            }        }    }    actions    {        area(Promoted)        {            actionref(CreateNewGenerationRuleForRecSetupGuide_Promoted; CreateNewGenerationRuleForRecSetupGuide)            {            }            actionref(CreateNewGenerationRuleForWhseSGuide_Promoted; CreateNewGenerationRuleForWhseSGuide)            {            }            actionref(CreateNewGenerationRuleForProdSGuide_Promoted; CreateNewGenerationRuleForProdSGuide)            {            }            actionref(CreateNewGenerationRuleForAsmSGuide_Promoted; CreateNewGenerationRuleForAsmSGuide)            {            }        }        area(Processing)        {            action(CreateNewGenerationRuleForAsmSGuide)            {                Caption = 'Create Assembly Rule';                ToolTip = 'Create a generation rule for assembly.';                Image = AssemblyBOM;                ApplicationArea = Assembly;                trigger OnAction()                var                    NewQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule";                    RecQltyAsmGenRuleSGuide: Page "Qlty. Asm. Gen. Rule S. Guide";                begin                    NewQltyInspectionGenRule.CopyFilters(Rec);                    RecQltyAsmGenRuleSGuide.RunModalWithGenerationRule(NewQltyInspectionGenRule);                    CurrPage.Update(false);                end;            }            action(EditGenerationRuleForAsmSGuide)            {                ApplicationArea = Assembly;                Caption = 'Edit Assembly Rule';                ToolTip = 'Edit a generation rule for assembly.';                Image = EditLines;                Scope = Repeater;                Visible = ShowEditAssemblyRuleSetupGuide;                trigger OnAction()                var                    QltyAsmGenRuleSGuide: Page "Qlty. Asm. Gen. Rule S. Guide";                    PreviousEntryNo: Integer;                begin                    PreviousEntryNo := Rec."Entry No.";                    QltyAsmGenRuleSGuide.RunModalWithGenerationRule(Rec);                    CurrPage.Update(false);                    Rec.Reset();                    Rec.SetRange("Entry No.", PreviousEntryNo);                    if Rec.FindSet() then;                    Rec.SetRange("Entry No.");                end;            }            action(CreateNewGenerationRuleForProdSGuide)            {                Caption = 'Create Production Rule';                ToolTip = 'Create a generation rule for production.';                Image = Production;                ApplicationArea = Manufacturing;                trigger OnAction()                var                    NewQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule";                    RecQltyProdGenRuleSGuide: Page "Qlty. Prod. Gen. Rule S. Guide";                begin                    NewQltyInspectionGenRule.CopyFilters(Rec);                    RecQltyProdGenRuleSGuide.RunModalWithGenerationRule(NewQltyInspectionGenRule);                    CurrPage.Update(false);                end;            }            action(EditGenerationRuleForProdSGuide)            {                ApplicationArea = Manufacturing;                Caption = 'Edit Production Rule';                ToolTip = 'Edit a generation rule for production.';                Image = EditLines;                Scope = Repeater;                Visible = ShowEditProductionRuleSetupGuide;                trigger OnAction()                var                    QltyProdGenRuleSGuide: Page "Qlty. Prod. Gen. Rule S. Guide";                    PreviousEntryNo: Integer;                begin                    PreviousEntryNo := Rec."Entry No.";                    QltyProdGenRuleSGuide.RunModalWithGenerationRule(Rec);                    CurrPage.Update(false);                    Rec.Reset();                    Rec.SetRange("Entry No.", PreviousEntryNo);                    if Rec.FindSet() then;                    Rec.SetRange("Entry No.");                end;            }            action(CreateNewGenerationRuleForRecSetupGuide)            {                Caption = 'Create Receiving Rule';                ToolTip = 'Create a generation rule for receiving.';                Image = Receipt;                ApplicationArea = All;                trigger OnAction()                var                    NewQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule";                    QltyRecGenRuleSGuide: Page "Qlty. Rec. Gen. Rule S. Guide";                begin                    NewQltyInspectionGenRule.CopyFilters(Rec);                    QltyRecGenRuleSGuide.RunModalWithGenerationRule(NewQltyInspectionGenRule);                    CurrPage.Update(false);                end;            }            action(EditGenerationRuleForRecSetupGuide)            {                ApplicationArea = All;                Caption = 'Edit Receiving Rule';                ToolTip = 'Edit a generation rule for receiving.';                Image = EditLines;                Scope = Repeater;                Visible = ShowEditReceivingRuleSetupGuide;                trigger OnAction()                var                    QltyRecGenRuleSGuide: Page "Qlty. Rec. Gen. Rule S. Guide";                    PreviousEntryNo: Integer;                begin                    PreviousEntryNo := Rec."Entry No.";                    QltyRecGenRuleSGuide.RunModalWithGenerationRule(Rec);                    CurrPage.Update(false);                    Rec.Reset();                    Rec.SetRange("Entry No.", PreviousEntryNo);                    if Rec.FindSet() then;                    Rec.SetRange("Entry No.");                end;            }            action(CreateNewGenerationRuleForWhseSGuide)            {                Caption = 'Create Bin Movement Rule';                ToolTip = 'Create a generation rule for warehouse bin movements.';                Image = CreateMovement;                ApplicationArea = Warehouse;                trigger OnAction()                var                    NewQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule";                    QltyWhseGenRuleSGuide: Page "Qlty. Whse. Gen. Rule S. Guide";                begin                    NewQltyInspectionGenRule.CopyFilters(Rec);                    QltyWhseGenRuleSGuide.RunModalWithGenerationRule(NewQltyInspectionGenRule);                    CurrPage.Update(false);                end;            }            action(EditGenerationRuleForWhseSGuide)            {                ApplicationArea = Warehouse;                Caption = 'Edit Bin Movement Rule';                ToolTip = 'Edit a generation rule for a bin movement.';                Image = EditAdjustments;                Scope = Repeater;                Visible = ShowEditMovementRuleSetupGuide;                trigger OnAction()                var                    QltyWhseGenRuleSGuide: Page "Qlty. Whse. Gen. Rule S. Guide";                    PreviousEntryNo: Integer;                begin                    PreviousEntryNo := Rec."Entry No.";                    QltyWhseGenRuleSGuide.RunModalWithGenerationRule(Rec);                    CurrPage.Update(false);                    Rec.Reset();                    Rec.SetRange("Entry No.", PreviousEntryNo);                    if Rec.FindSet() then;                    Rec.SetRange("Entry No.");                end;            }            action(JobQueueEntries)            {                ApplicationArea = All;                Caption = 'Job Queue Entries';                ToolTip = 'Display related job queue entries.';                Image = EntriesList;                Scope = Repeater;                Visible = ShowJobQueueEntries;                trigger OnAction()                var                    QltyJobQueueManagement: Codeunit "Qlty. Job Queue Management";                begin                    QltyJobQueueManagement.RunPageLookupJobQueueEntriesForScheduleGroup(Rec."Schedule Group");                end;            }            action(CreateAnotherJobQueue)            {                ApplicationArea = All;                Caption = 'Create a Job Queue Entry';                ToolTip = 'Creates another job queue entry.';                Image = SelectEntries;                Scope = Repeater;                Visible = ShowJobQueueEntries;                trigger OnAction()                var                    QltyJobQueueManagement: Codeunit "Qlty. Job Queue Management";                begin                    QltyJobQueueManagement.PromptCreateJobQueueEntry(Rec."Schedule Group");                end;            }        }    }    views    {        view(viewEnabled)        {            Caption = 'Enabled';            Filters = where("Activation Trigger" = filter("Manual only" | "Manual or Automatic" | "Automatic only"));        }        view(viewDisabled)        {            Caption = 'Disabled';            Filters = where("Activation Trigger" = filter(Disabled));        }    }    var        ShowSortAndTemplate: Boolean;        ShowEditMovementRuleSetupGuide: Boolean;        ShowEditReceivingRuleSetupGuide: Boolean;        ShowEditProductionRuleSetupGuide: Boolean;        ShowEditAssemblyRuleSetupGuide: Boolean;        TemplateCode: Code[20];        ShowAssemblyTrigger: Boolean;        ShowProductionTrigger: Boolean;        ShowPurchaseTrigger: Boolean;        ShowSalesReturnTrigger: Boolean;        ShowTransferTrigger: Boolean;        ShowWarehouseReceiveTrigger: Boolean;        ShowWarehouseMovementTrigger: Boolean;        EditAssemblyTrigger: Boolean;        EditProductionTrigger: Boolean;        EditPurchaseTrigger: Boolean;        EditSalesReturnTrigger: Boolean;        EditTransferTrigger: Boolean;        EditWarehouseReceiveTrigger: Boolean;        EditWarehouseMovementTrigger: Boolean;        ShowJobQueueEntries: Boolean;        AssemblyStyle: Text;        ProductionStyle: Text;        PurchaseStyle: Text;        SalesReturnStyle: Text;        WhseReceiveStyle: Text;        WhseMovementStyle: Text;        TransferStyle: Text;        RowStyle: Option None,Standard,StandardAccent,Strong,StrongAccent,Attention,AttentionAccent,Favorable,Unfavorable,Ambiguous,Subordinate;        GenerationRulesCaptionLbl: Label 'Quality Inspection Generation Rules';        GenerationRulesCaptionForTemplateLbl: Label 'Quality Inspection Generation Rules for %1', Comment = '%1=the template';        DefaultScheduleGroupLbl: Label 'QM', Locked = true;    trigger OnInit()    begin        ShowSortAndTemplate := true;        Rec.UpdateSortOrder();    end;    trigger OnFindRecord(Which: Text): Boolean    begin        IdentifyIfPageStartedWithATemplate();        SetTriggerColumnVisibleState();        exit(Rec.Find(Which));    end;    trigger OnOpenPage()    var        QltyInspecGenRuleMgmt: Codeunit "Qlty. Inspec. Gen. Rule Mgmt.";        QltyMgmtFeatureTelemetry: Codeunit "Qlty. Mgmt. Feature Telemetry";    begin        QltyMgmtFeatureTelemetry.LogFeatureUptakeDiscovered(ObjectType::Page, Page::"Qlty. Inspection Gen. Rules");        Rec.SetFilter("Table ID Filter", QltyInspecGenRuleMgmt.GetFilterForAvailableConfigurations());        AttemptUpdateUnknownIntents();        IdentifyIfPageStartedWithATemplate();        SetTriggerColumnVisibleState();        CurrPage.Update(false);    end;    trigger OnNewRecord(BelowxRec: Boolean)    var        SourceTableFilter: Text;    begin        Rec.SetEntryNo();        Rec.UpdateSortOrder();        IdentifyIfPageStartedWithATemplate();        if xRec."Source Table No." <> 0 then            Rec."Source Table No." := xRec."Source Table No.";        SourceTableFilter := Rec.GetFilter("Source Table No.");        if SourceTableFilter.IndexOf('|') > 0 then            Rec."Source Table No." := Rec.GetRangeMin("Source Table No.");        Rec.CalcFields("Table Caption");    end;    trigger OnAfterGetCurrRecord()    begin        UpdateControls();    end;    trigger OnAfterGetRecord()    begin        Rec.CalcFields("Table Caption");        UpdateControls();    end;    /// <summary>    /// Updates row-specific trigger visibility, editability, styles, and setup guide actions from the rule intent.    /// </summary>    local procedure UpdateControls()    var        KnownOrInferredIntent: Enum "Qlty. Gen. Rule Intent";        Certainty: Enum "Qlty. Certainty";    begin        KnownOrInferredIntent := Rec.Intent;        ShowJobQueueEntries := Rec."Schedule Group" <> '';        ClearRowSpecificVisibleAndEditFlags();        if KnownOrInferredIntent = KnownOrInferredIntent::Unknown then begin            Rec.InferGenerationRuleIntent(KnownOrInferredIntent, Certainty);            if Certainty = Certainty::Maybe then begin                ShowEditProductionRuleSetupGuide := true;                ShowEditReceivingRuleSetupGuide := true;                ShowEditMovementRuleSetupGuide := true;                ShowEditAssemblyRuleSetupGuide := true;                EditAssemblyTrigger := true;                EditProductionTrigger := true;                EditPurchaseTrigger := true;                EditSalesReturnTrigger := true;                EditTransferTrigger := true;                EditWarehouseMovementTrigger := true;                EditWarehouseReceiveTrigger := true;                AssemblyStyle := Format(RowStyle::Ambiguous);                ProductionStyle := Format(RowStyle::Ambiguous);                PurchaseStyle := Format(RowStyle::Ambiguous);                SalesReturnStyle := Format(RowStyle::Ambiguous);                WhseReceiveStyle := Format(RowStyle::Ambiguous);                WhseMovementStyle := Format(RowStyle::Ambiguous);                TransferStyle := Format(RowStyle::Ambiguous);            end;        end;        case KnownOrInferredIntent of            Rec.Intent::Assembly:                begin                    ShowEditAssemblyRuleSetupGuide := true;                    EditAssemblyTrigger := true;                    AssemblyStyle := Format(RowStyle::Standard);                end;            Rec.Intent::Production:                begin                    ShowEditProductionRuleSetupGuide := true;                    EditProductionTrigger := true;                    ProductionStyle := Format(RowStyle::Standard);                end;            Rec.Intent::Purchase:                begin                    ShowEditReceivingRuleSetupGuide := true;                    EditPurchaseTrigger := true;                    PurchaseStyle := Format(RowStyle::Standard);                end;            Rec.Intent::"Sales Return":                begin                    ShowEditReceivingRuleSetupGuide := true;                    EditSalesReturnTrigger := true;                    SalesReturnStyle := Format(RowStyle::Standard);                end;            Rec.Intent::Transfer:                begin                    ShowEditReceivingRuleSetupGuide := true;                    EditTransferTrigger := true;                    TransferStyle := Format(RowStyle::Standard);                end;            Rec.Intent::"Warehouse Receipt":                begin                    ShowEditReceivingRuleSetupGuide := true;                    EditWarehouseReceiveTrigger := true;                    WhseReceiveStyle := Format(RowStyle::Standard);                end;            Rec.Intent::"Warehouse Movement":                begin                    ShowEditMovementRuleSetupGuide := true;                    EditWarehouseMovementTrigger := true;                    WhseMovementStyle := Format(RowStyle::Standard);                end;        end;    end;    /// <summary>    /// Resets row-specific setup guide, trigger edit, and style state to subordinate defaults.    /// </summary>    local procedure ClearRowSpecificVisibleAndEditFlags()    begin        ShowEditReceivingRuleSetupGuide := false;        ShowEditProductionRuleSetupGuide := false;        ShowEditAssemblyRuleSetupGuide := false;        ShowEditMovementRuleSetupGuide := false;        EditProductionTrigger := false;        EditAssemblyTrigger := false;        EditPurchaseTrigger := false;        EditSalesReturnTrigger := false;        EditTransferTrigger := false;        EditWarehouseReceiveTrigger := false;        EditWarehouseMovementTrigger := false;        AssemblyStyle := Format(RowStyle::Subordinate);        ProductionStyle := Format(RowStyle::Subordinate);        PurchaseStyle := Format(RowStyle::Subordinate);        SalesReturnStyle := Format(RowStyle::Subordinate);        WhseReceiveStyle := Format(RowStyle::Subordinate);        WhseMovementStyle := Format(RowStyle::Subordinate);        TransferStyle := Format(RowStyle::Subordinate);    end;    /// <summary>    /// Resolves the template filter and determines whether sort and template columns are shown.    /// </summary>    local procedure IdentifyIfPageStartedWithATemplate()    begin        TemplateCode := Rec.GetTemplateCodeFromRecordOrFilter(true);        ShowSortAndTemplate := (TemplateCode = '');    end;    /// <summary>    /// Builds the page caption for all generation rules or the filtered template.    /// </summary>    /// <returns>The generation rules page caption.</returns>    local procedure GetDataCaptionExpression(): Text    begin        exit((TemplateCode = '') ? GenerationRulesCaptionLbl : StrSubstNo(GenerationRulesCaptionForTemplateLbl, TemplateCode));    end;    /// <summary>    /// Shows trigger columns required by visible rule intents or enabled setup triggers.    /// </summary>    local procedure SetTriggerColumnVisibleState()    var        QltyManagementSetup: Record "Qlty. Management Setup";        QltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule";    begin        ShowAssemblyTrigger := false;        ShowProductionTrigger := false;        ShowPurchaseTrigger := false;        ShowSalesReturnTrigger := false;        ShowTransferTrigger := false;        ShowWarehouseReceiveTrigger := false;        ShowWarehouseMovementTrigger := false;        QltyInspectionGenRule.CopyFilters(Rec);        QltyInspectionGenRule.SetLoadFields(Intent);        QltyInspectionGenRule.SetRange(Intent, QltyInspectionGenRule.Intent::Assembly);        if not QltyInspectionGenRule.IsEmpty() then            ShowAssemblyTrigger := true;        QltyInspectionGenRule.SetRange(Intent, QltyInspectionGenRule.Intent::Production);        if not QltyInspectionGenRule.IsEmpty() then            ShowProductionTrigger := true;        QltyInspectionGenRule.SetRange(Intent, QltyInspectionGenRule.Intent::Purchase);        if not QltyInspectionGenRule.IsEmpty() then            ShowPurchaseTrigger := true;        QltyInspectionGenRule.SetRange(Intent, QltyInspectionGenRule.Intent::"Sales Return");        if not QltyInspectionGenRule.IsEmpty() then            ShowSalesReturnTrigger := true;        QltyInspectionGenRule.SetRange(Intent, QltyInspectionGenRule.Intent::Transfer);        if not QltyInspectionGenRule.IsEmpty() then            ShowTransferTrigger := true;        QltyInspectionGenRule.SetRange(Intent, QltyInspectionGenRule.Intent::"Warehouse Receipt");        if not QltyInspectionGenRule.IsEmpty() then            ShowWarehouseReceiveTrigger := true;        QltyInspectionGenRule.SetRange(Intent, QltyInspectionGenRule.Intent::"Warehouse Movement");        if not QltyInspectionGenRule.IsEmpty() then            ShowWarehouseMovementTrigger := true;        QltyInspectionGenRule.SetRange(Intent, QltyInspectionGenRule.Intent::Unknown);        if not QltyInspectionGenRule.IsEmpty() then begin            ShowAssemblyTrigger := true;            ShowProductionTrigger := true;            ShowPurchaseTrigger := true;            ShowSalesReturnTrigger := true;            ShowTransferTrigger := true;            ShowWarehouseReceiveTrigger := true;            ShowWarehouseMovementTrigger := true;        end;        if not QltyManagementSetup.Get() then            exit;        if QltyManagementSetup."Assembly Trigger" <> QltyManagementSetup."Assembly Trigger"::NoTrigger then            ShowAssemblyTrigger := true;        if QltyManagementSetup."Production Order Trigger" <> QltyManagementSetup."Production Order Trigger"::NoTrigger then            ShowProductionTrigger := true;        if QltyManagementSetup."Purchase Order Trigger" <> QltyManagementSetup."Purchase Order Trigger"::NoTrigger then            ShowPurchaseTrigger := true;        if QltyManagementSetup."Sales Return Trigger" <> QltyManagementSetup."Sales Return Trigger"::NoTrigger then            ShowSalesReturnTrigger := true;        if QltyManagementSetup."Transfer Order Trigger" <> QltyManagementSetup."Transfer Order Trigger"::NoTrigger then            ShowTransferTrigger := true;        if QltyManagementSetup."Warehouse Receipt Trigger" <> QltyManagementSetup."Warehouse Receipt Trigger"::NoTrigger then            ShowWarehouseReceiveTrigger := true;        if QltyManagementSetup."Warehouse Trigger" <> QltyManagementSetup."Warehouse Trigger"::NoTrigger then            ShowWarehouseMovementTrigger := true;    end;    /// <summary>    /// Infers and persists intent and default triggers for rules whose intent is unknown when write access is available.    /// </summary>    local procedure AttemptUpdateUnknownIntents()    var        QltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule";    begin        if not QltyInspectionGenRule.WritePermission() then            exit;        QltyInspectionGenRule.SetRange(Intent, QltyInspectionGenRule.Intent::Unknown);        if not QltyInspectionGenRule.IsEmpty() then            if QltyInspectionGenRule.FindSet() then                repeat                    QltyInspectionGenRule.SetIntentAndDefaultTriggerValuesFromSetup();                    QltyInspectionGenRule.Modify();                until QltyInspectionGenRule.Next() = 0;    end;}