Codeunit 20404 "Qlty. Inspection - Create"
Quality Management · Microsoft.QualityManagement.Document
Across versions
- BC23-28not present
- BC29present
- BC30changed
Neighbourhood 18 connected objects and pages
Quality Management · Microsoft.QualityManagement.Document · BC29-30 · source at ea08af5e · facts from BC29
Properties
| Property | Value |
|---|---|
| Permissions | tabledata “Qlty. Management Setup” = r, tabledata “Qlty. Inspection Gen. Rule” = r, tabledata “Qlty. Inspection Header” = rim, tabledata “Qlty. Inspection Line” = rim, tabledata “Qlty. I. Result Condit. Conf.” = rim, tabledata “Qlty. Inspection Template Line” = r |
Events published
OnBeforeCreateInspection(var TargetRecordRef: RecordRef; var IsManualCreation: Boolean; var OptionalSpecificTemplate: Code[20]; var IsHandled: Boolean; var OptionalRec2Variant: Variant; var OptionalRec3Variant: Variant)(integration): OnBeforeCreateInspection is called before an inspection is created. Use this event to do additional checks before an inspection is created.OnAfterCreateInspectionBeforeDialog(var TargetRecordRef: RecordRef; var TriggeringRecordRef: RecordRef; var IsManualCreation: Boolean; var OptionalSpecificTemplate: Code[20]; var TempQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule" temporary; var QltyInspectionHeader: Record "Qlty. Inspection Header"; var OptionalRec2Variant: Variant; var OptionalRec3Variant: Variant)(integration): OnAfterCreateInspectionBeforeDialog gets called after a Quality Inspection has been created and before any interactive dialog is shown.OnAfterCreateInspectionAfterDialog(var TargetRecordRef: RecordRef; var TriggeringRecordRef: RecordRef; var IsManualCreation: Boolean; var OptionalSpecificTemplate: Code[20]; var TempQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule" temporary; var QltyInspectionHeader: Record "Qlty. Inspection Header"; var OptionalRec2Variant: Variant; var OptionalRec3Variant: Variant)(integration): OnAfterCreateInspectionAfterDialog gets called after a Quality Inspection has been created after any interactive dialog is shownOnCustomCreateInspectionBehavior(var TargetRecordRef: RecordRef; var OriginalTriggeringRecordRef: RecordRef; var TempQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule" temporary; var HasExistingInspection: Boolean; var PrecedingQltyInspectionHeader: Record "Qlty. Inspection Header"; var NeedNewInspection: Boolean; var ShouldCreateReinspection: Boolean)(integration): Implement OnCustomCreateInspectionBehavior if you have also extended enum 20402 “Qlty. Inspect. Creation Option” This is where you will provide any custom Inspection Creation Options to match your enum extension. Only set handled to true if you want to skip the remaining behavior.OnBeforeCreateReinspection(var FromThisQltyInspectionHeader: Record "Qlty. Inspection Header"; var CreatedReQltyInspectionHeader: Record "Qlty. Inspection Header"; var IsHandled: Boolean)(integration): OnBeforeCreateReinspection supplies an opportunity to change how manual Re-inspections are performed.OnAfterCreateReinspection(var FromThisQltyInspectionHeader: Record "Qlty. Inspection Header"; var CreatedReQltyInspectionHeader: Record "Qlty. Inspection Header")(integration): OnAfterCreateReinspection gives an opportunity to integrate with the re-inspection record after a manual re-inspection is created.OnBeforeFindExistingInspection(TargetRecordRef: RecordRef; Optional2RecordRef: RecordRef; Optional3RecordRef: RecordRef; Optional4RecordRef: RecordRef; var QltyInspectionHeader: Record "Qlty. Inspection Header"; var Result: Boolean; var IsHandled: Boolean)(integration): OnBeforeFindExistingInspection provides an opportunity to override how an existing inspection is found.
Event subscriptions
- HandleReservationManagementOnAfterSetReservSource subscribes to Codeunit “Reservation Management” OnAfterSetReservSource
Procedures
CreateInspectionWithVariant(ReferenceVariant: Variant; IsManualCreation: Boolean): Boolean(internal): Creates a quality inspection from a variant object using generation rule configuration. Automatically determines the most appropriate inspection template based on configured generation rules. The variant can be a Record, RecordRef, or RecordId. The procedure will: 1. Match against configured generat…CreateInspectionWithVariantAndTemplate(ReferenceVariant: Variant; IsManualCreation: Boolean; OptionalSpecificTemplate: Code[20]): Boolean(internal): Creates a quality inspection from a variant object using a specified template. Bypasses automatic template selection and uses the provided template code directly. Use this when: - Template is predetermined (not rule-based selection) - Specific template is required regardless of generation rules - Ma…CreateInspectionWithMultiVariants(OptionalRec1Variant: Variant; OptionalRec2Variant: Variant; OptionalRec3Variant: Variant; OptionalRec4Variant: Variant; IsManualCreation: Boolean; var TempFiltersQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule" temporary): Boolean(internal): Creates an inspection using multiple variant records, attempting each in sequence until successful. Allows filtering generation rules by auto inspection creation trigger through the provided generation rule record. Creation strategy: 1. Try creating inspection from OptionalRec1Variant with others as…CreateInspectionWithMultiVariantsAndTemplate(OptionalRec1Variant: Variant; OptionalRec2Variant: Variant; OptionalRec3Variant: Variant; OptionalRec4Variant: Variant; IsManualCreation: Boolean; OptionalSpecificTemplate: Code[20]): Boolean(internal): Tries each supplied record variant as the primary source until an inspection is created with the specified template.CreateInspection(TargetRecordRef: RecordRef; IsManualCreation: Boolean): Boolean(internal): Creates an inspection for a record reference using matching generation-rule configuration. Use this to create a quality inspection for any given record. The generation rule configuration will be used to find the most appropriate inspection to create.CreateInspectionWithSpecificTemplate(TargetRecordRef: RecordRef; IsManualCreation: Boolean; OptionalSpecificTemplate: Code[20]): Boolean(internal): Creates an inspection for a record reference using a specific template. If you do not know which template you need, use CreateInspection. If you do know which template you need, then use this procedure. The caller must know in advance that the template and configuration is correct.FindExistingInspectionWithVariant(RaiseErrorIfNoRuleIsFound: Boolean; ReferenceVariant: Variant; var QltyInspectionHeader: Record "Qlty. Inspection Header"): Boolean(internal): Finds existing inspections for a primary source record variant.FindExistingInspectionWithMultipleVariants(RaiseErrorIfNoRuleIsFound: Boolean; ReferenceVariant: Variant; OptionalVariant2: Variant; OptionalVariant3: Variant; OptionalVariant4: Variant; var QltyInspectionHeader: Record "Qlty. Inspection Header"): Boolean(internal): Finds existing inspections using a primary source variant and up to three related source variants.FindExistingInspection(RaiseErrorIfNoRuleIsFound: Boolean; TargetRecordRef: RecordRef; Optional2RecordRef: RecordRef; Optional3RecordRef: RecordRef; Optional4RecordRef: RecordRef; var QltyInspectionHeader: Record "Qlty. Inspection Header"): Boolean(internal): Finds and marks inspections matching generation rules and the supplied source records.FindExistingInspectionWithVariant(TargetRecordRef: RecordRef; OptionalVariant2: Variant; OptionalVariant3: Variant; OptionalVariant4: Variant; TempQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule" temporary; var PrecedingQltyInspectionHeader: Record "Qlty. Inspection Header"; FindAll: Boolean): Boolean(internal): Finds inspections matching a primary source record, optional source variants, and a generation rule.FindExistingInspection(TargetRecordRef: RecordRef; Optional2RecordRef: RecordRef; Optional3RecordRef: RecordRef; Optional4RecordRef: RecordRef; TempQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule" temporary; var PrecedingQltyInspectionHeader: Record "Qlty. Inspection Header"; FindAll: Boolean): Boolean(internal): Finds inspections matching up to four source records and a generation rule.CreateReinspection(FromThisQltyInspectionHeader: Record "Qlty. Inspection Header"; var CreatedReinspectionQltyInspectionHeader: Record "Qlty. Inspection Header")(internal): Creates the next reinspection from the latest inspection with the same number.GetCreatedInspection(var LastCreatedQltyInspectionHeader2: Record "Qlty. Inspection Header"): Boolean(internal): Gets the inspection resolved by the latest creation call on this codeunit instance. Only use if you just called one of the CreateInspection() procedures.GetLastCreatedStatus(): Enum "Qlty. Inspection Create Status"(internal): Gets the status from the latest inspection creation attempt.IsLastInspectionNewlyCreated(): Boolean(internal): Determines whether the latest resolved inspection was newly inserted rather than reused.CreateMultipleInspectionsForMarkedTrackingSpecification(var TempTrackingSpecification: Record "Tracking Specification" temporary)(internal): Creates inspections for the marked temporary tracking specifications as a manual operation.CreateMultipleInspectionsForMarkedTrackingSpecification(var TempTrackingSpecification: Record "Tracking Specification" temporary; IsManualCreation: Boolean)(internal): Creates inspections for the marked temporary tracking specifications.CreateMultipleInspectionsForMultipleRecords(var SetOfRecordsRecordRef: RecordRef; IsManualCreation: Boolean)(internal): Creates inspections for a set of records without generation-rule filters.CreateMultipleInspectionsForMultipleRecords(var SetOfRecordsRecordRef: RecordRef; IsManualCreation: Boolean; var TempFiltersQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule" temporary)(internal): Creates or resolves inspections for a set of records and displays manual results when appropriate.DisplayInspectionsIfConfigured(IsManualCreation: Boolean; var ToDisplayQltyInspectionIds: List of [Code[20]])(internal): Shows one or more resolved inspections, falling back to notifications when pages cannot be opened or filters are too long.CreateMultipleInspectionsWithoutDisplaying(var SetOfRecordsRecordRef: RecordRef; IsManualCreation: Boolean; var TempFiltersQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule" temporary; var NewlyCreatedQltyInspectionIds: List of [Code[20]]; var AllResolvedQltyInspectionIds: List of [Code[20]])(internal): Resolves inspections for multiple records without displaying them and separates new from reused inspections.SetPreventDisplayingInspectionEvenIfConfigured(PreventDisplayingInspectionEvenIfConfigured: Boolean)(internal): Sets whether generated inspections should remain hidden even when setup would display them.
Plus 13 local procedures.
Calls
From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an Object::"Name" argument. Interface dispatch and calls through events are not counted, so the list is not complete.
- Codeunit 20408 “Qlty. Traversal” (5 calls:
ApplyAllSourceFieldsToStub → ApplySourceFields,CreateInspectionForSelfOrDirectParent → FindRelatedItem,CreateInspectionForSelfOrDirectParent → FindSingleParentRecord, …) - Codeunit 20437 “Qlty. Notification Mgmt.” (3 calls:
DisplayInspectionsIfConfigured → NotifyInspectionCreated,DisplayInspectionsIfConfigured → NotifyMultipleInspectionsCreated,DisplayInspectionsIfConfigured → NotifyMultipleInspectionsCreatedByCount) - Codeunit 20599 “Qlty. Misc Helpers” (3 calls:
FindExistingInspectionWithMultipleVariants → GetRecordRefFromVariant,InternalCreateInspectionWithGenerationRule → GetRecordRefFromVariant,InternalCreateInspectionWithVariantAndTemplate → GetRecordRefFromVariant) - Codeunit 20405 “Qlty. Inspec. Gen. Rule Mgmt.” (2 calls:
CreateInspectionForSelfOrDirectParent → DoesMatchItemAttributeFiltersOrNoFilter,FindExistingInspection → FindMatchingGenerationRule) - Codeunit 701 “Data Type Management” (2 calls:
ApplyAllSourceFieldsToStub → GetRecordRef,FindExistingInspectionWithMultipleVariants → GetRecordRef) - Codeunit 20409 “Qlty. Result Condition Mgmt.” (1 call:
CreateQualityInspectionResultLinesFromTemplate → CopyResultConditionsFromTemplateToInspection) - Codeunit 20410 “Qlty. Result Evaluation” (1 call:
CreateQualityInspectionResultLinesFromTemplate → TryValidateQltyInspectionLine) - Codeunit 20428 “Qlty. Item Tracking” (1 call:
CreateInspectionForSelfOrDirectParent → IsItemTrackingUsed) - Codeunit 99000845 “Reservation Management” (1 call:
CreateInspectionForSelfOrDirectParent → SetReservSource)
Called by
- Codeunit 20411 “Qlty. Receiving Integration” (15 calls:
AttemptCreateInspectionWithPurchaseLineAndTracking → CreateInspectionWithMultiVariants,AttemptCreateInspectionWithPurchaseLineAndTracking → GetCreatedInspection,AttemptCreateInspectionWithPurchaseLineAndTracking → IsLastInspectionNewlyCreated, …) - Codeunit 20407 “Qlty. Manufactur. Integration” (5 calls:
AttemptCreateInspectionPosting → CreateInspectionWithMultiVariants,AttemptCreateInspectionPosting → GetCreatedInspection,AttemptCreateInspectionReleased → CreateInspectionWithMultiVariants, …) - Page 20415 “Qlty. Create Inspection API” (4 calls:
CreateInspectionFromRecordID → CreateInspection,CreateInspectionFromRecordID → GetCreatedInspection,CreateInspectionFromTableIDAndFilter → CreateInspection, …) - Codeunit 20412 “Qlty. Assembly Integration” (3 calls:
HandleOnAfterPost → CreateInspectionWithMultiVariants,HandleOnAfterPost → GetCreatedInspection,HandleOnAfterPost → IsLastInspectionNewlyCreated) - Codeunit 20438 “Qlty. Warehouse Integration” (3 calls:
AttemptCreateInspectionWithWhseJournalLine → CreateInspectionWithMultiVariants,AttemptCreateInspectionWithWhseJournalLine → GetCreatedInspection,AttemptCreateInspectionWithWhseJournalLine → IsLastInspectionNewlyCreated) - Codeunit 20424 “Qlty. Workflow Response” (2 calls:
HandleOnExecuteWorkflowResponse → CreateInspection,HandleOnExecuteWorkflowResponse → GetCreatedInspection) - Codeunit 20456 “Qlty. Batch Notif. Helper” (2 calls:
ConfigureForBatch → SetPreventDisplayingInspectionEvenIfConfigured,EndBatch → DisplayInspectionsIfConfigured) - Report 20412 “Qlty. Schedule Inspection” (2 calls:
CreateInspectionsPerSourceConfigFilter → CreateMultipleInspectionsWithoutDisplaying,OnPostReport → DisplayInspectionsIfConfigured) - Report 20400 “Qlty. Create Inspection” (1 call:
CreateQltyInspection → CreateInspectionWithMultiVariantsAndTemplate)
Recent changes
- 2026-10-05 #11129 [Quality Management] Refactor permission management (main, BC30, refactor)
- 2026-08-20 #10270 [Quality Management] Repair and improve XML documentation of procedures (main, BC30, refactor)
- 2026-07-08 #8556 [Quality Management] Enforce rules and restrictions with indirect and implicit permissions (main, BC30, feature)
Ask your agent
Procedure bodies are not stored here (D10). The call sections above are our own, per object, from the BC29 call graph. For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: bcatlas_resolve_node(object_type: "codeunit", object_name: "Qlty. Inspection - Create"), then bcatlas_get_procedure_body or bcatlas_get_neighbors on the returned id.