Skip to content

KVSFCYItemAttributeMgt#

Procedures#

GetUniqueMappingNoByRecordID(RecordId, Boolean) : Code[20]#

Summary: Retrieves or generates a unique mapping number for item attribute value mappings based on record ID. For simple entities (Item, Item Category, Nonstock Item), returns the primary key directly. For complex entities (Item Variant, Item Version), searches existing mapping records or creates new entries in the item attribute variant version mapping table with auto-generated IDs. Supports both search-only and create-if-missing modes to accommodate different workflow requirements in attribute management systems.

procedure GetUniqueMappingNoByRecordID(SearchRecID: RecordId; JustSearchPar: Boolean): Code[20]

Parameters:

  • SearchRecID: Record ID of the entity for which to retrieve or generate the unique mapping number.
  • JustSearchPar: When true, only searches existing mappings without creating new records; when false, creates missing mapping entries automatically.

Returns: Unique mapping number as Code[20] - primary key for simple entities or generated ID for complex entities; empty if not found in search-only mode.

LoadAttributes(Record Item Attribute Value Selection, RecordId) :#

Summary: Loads all item attributes and their values for a given record into a temporary selection buffer. For Item Category records, traverses the hierarchy upward to parent categories, loading inherited attributes with proper inheritance levels and source tracking. For other record types, loads attributes directly associated with the specific record. Clears existing selection data and populates comprehensive attribute information including values, inheritance details, and sorting for user interface presentation.

procedure LoadAttributes(var TempItemAttributeValueSelectionVar: Record "Item Attribute Value Selection" temporary; RecIDPar: RecordId): 

Parameters:

  • TempItemAttributeValueSelectionVar: Temporary record buffer to populate with loaded attribute selections, including values, inheritance levels, and display information.
  • RecIDPar: Record ID of the entity (Item, Item Category, Item Variant, Item Version, etc.) for which to load attribute information.

SearchAttributeSelectionTable(Record Item Attribute Value Selection, Record Item Attribute, Integer) :#

Summary: Searches for and validates item attributes based on user input in attribute selection interfaces. Supports searching by attribute name or custom attribute code, utilizing intelligent record discovery to find matching attributes with autocomplete functionality. Validates that found attributes are not blocked and updates the selection record with the corresponding attribute ID for further processing. Provides error feedback when specified attribute values cannot be located in the system.

procedure SearchAttributeSelectionTable(var ItemAttributeValueSelectionVar: Record "Item Attribute Value Selection"; var ItemAttributeVar: Record "Item Attribute"; FieldNoPar: Integer): 

Parameters:

  • ItemAttributeValueSelectionVar: Item attribute value selection record containing the search input and receiving the found attribute ID.
  • ItemAttributeVar: Item attribute record variable to populate with the found attribute details for validation and further use.
  • FieldNoPar: Field number indicating which field contains the search value - either Attribute Name or custom Attribute Code field.

SetValuesFromItemAttrVarVersMapp(Integer, Integer, Code[20], Code[20], Code[10], Code[20]) :#

Summary: Extracts and populates item hierarchy information from item attribute variant version mapping records. For simple entities (Item, Nonstock Item), directly assigns the primary key to item number and clears variant/version codes. For complex entities (Item Variant, Item Version), retrieves the mapping record and extracts the complete hierarchy including item number, variant code, and version code as applicable. Provides extensibility through event integration for custom table handling in specialized business scenarios. Essential for attribute management workflows that need to reconstruct item context from mapping identifiers.

procedure SetValuesFromItemAttrVarVersMapp(TableID: Integer; AttributeID: Integer; NoPar: Code[20]; var ItemNoVar: Code[20]; var VariantCodeVar: Code[10]; var VersionCodeVar: Code[20]): 

Parameters:

  • TableID: Table ID identifying the type of entity in the mapping system (Item, Item Variant, Item Version, Nonstock Item, etc.).
  • AttributeID: Attribute ID used for mapping record lookup in complex entity scenarios (Item Variant, Item Version).
  • NoPar: Primary identifier code used for direct assignment in simple entities or lookup key for complex entities.
  • ItemNoVar: Output parameter receiving the item number extracted from the mapping or direct assignment.
  • VariantCodeVar: Output parameter receiving the variant code for Item Variant and Item Version entities, empty for others.
  • VersionCodeVar: Output parameter receiving the version code for Item Version entities, empty for others.

UpdateMappingFromSelection(Record Item Attribute Value Selection) :#

Summary: Updates the persistent item attribute value mapping record from the current state of an item attribute value selection. Retrieves the corresponding mapping record based on the selection's record ID and attribute information, then synchronizes all field values from the temporary selection buffer to the permanent mapping table. Essential for persisting user changes made through attribute selection interfaces back to the database, ensuring that attribute assignments, values, unit of measure codes, and other configuration details are properly stored and maintained across different business entity types in the attribute management system.

procedure UpdateMappingFromSelection(ItemAttributeValueSelectionPar: Record "Item Attribute Value Selection"): 

Parameters:

  • ItemAttributeValueSelectionPar: Item attribute value selection record containing the current state and values to be persisted to the mapping table.

CheckDefaultValueExistsAsValue(Text, Record Item Attribute) :#

Summary: Validates that a specified default value exists as a valid option value for option-type item attributes. For Option-type attributes with non-empty default values, searches the item attribute values table to verify that the specified default value exists as a defined option. Performs case-sensitive validation to ensure exact matching of option values. Raises an error if the default value does not exist as a valid option, preventing invalid default value assignments that could cause data integrity issues in attribute management workflows and user interface operations that depend on valid option selections.

procedure CheckDefaultValueExistsAsValue(var ValueToCheckVar: Text; ItemAttributePar: Record "Item Attribute"): 

Parameters:

  • ValueToCheckVar: Default value text to validate against existing option values - must match exactly with defined attribute option values.
  • ItemAttributePar: Item attribute record containing the attribute definition and type information for validation context.

Events#

OnAfterItemAttributeValueMappingDelete(Integer, Code[20]) :#

Obsolete

This Element will be removed or changed with a future Version of the App.

[Obsolete('Event is no longer triggered', '27.0')]
[IntegrationEvent(false, false)]
local procedure OnAfterItemAttributeValueMappingDelete(AttributeToDeleteID: Integer; RelatedRecordCode: Code[20]): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSFCYItemAttributeMgt", 'OnAfterItemAttributeValueMappingDelete', '', false, false)]
local procedure DoSomethingOnAfterItemAttributeValueMappingDelete(AttributeToDeleteID: Integer; RelatedRecordCode: Code[20])
begin
end;

OnAfterValidateType(Text, Record Item Attribute) :#

Summary: Integration event that is raised after validating the data type of an item attribute value during input validation processes, providing an extension point for implementing custom validation logic or additional data type checks beyond the standard type validation for Text, Option, Decimal, Integer, and Date attribute types.

[IntegrationEvent(false, false)]
local procedure OnAfterValidateType(var ValueToValidate: Text; ItemAttributePar: Record "Item Attribute"): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSFCYItemAttributeMgt", 'OnAfterValidateType', '', false, false)]
local procedure DoSomethingOnAfterValidateType(var ValueToValidate: Text; ItemAttributePar: Record "Item Attribute")
begin
end;

Parameters:

  • ValueToValidate: Text variable (passed by reference) containing the value being validated, allowing extensions to modify the value or perform additional validation checks after standard type validation.
  • ItemAttributePar: Item Attribute record containing the attribute definition including type information, constraints, and validation rules, providing context for custom validation logic implementation.

OnAfterValidateValue(Record Item Attribute Value Selection) :#

Summary: Integration event that is raised after validating and updating an item attribute value in the attribute value selection interface, providing an extension point for implementing custom post-validation logic, triggering additional updates, or performing business rule validation after value changes have been processed and stored.

[IntegrationEvent(false, false)]
local procedure OnAfterValidateValue(var ItemAttributeValueSelectionVar: Record "Item Attribute Value Selection" temporary): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSFCYItemAttributeMgt", 'OnAfterValidateValue', '', false, false)]
local procedure DoSomethingOnAfterValidateValue(var ItemAttributeValueSelectionVar: Record "Item Attribute Value Selection" temporary)
begin
end;

Parameters:

  • ItemAttributeValueSelectionVar: Item Attribute Value Selection record (passed by reference) containing the validated and updated attribute value information, enabling extensions to access the final validated state and implement additional business logic.

OnAfterCopyAttributeUnitToSelection(Record Item Attribute Value Selection, Record Unit of Measure) :#

Obsolete

This Element will be removed or changed with a future Version of the App.

[Obsolete('Event is no longer triggered', '27.0')]
[IntegrationEvent(false, false)]
local procedure OnAfterCopyAttributeUnitToSelection(var ItemAttributeValueSelectionVar: Record "Item Attribute Value Selection" temporary; UnitofMeasure: Record "Unit of Measure"): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSFCYItemAttributeMgt", 'OnAfterCopyAttributeUnitToSelection', '', false, false)]
local procedure DoSomethingOnAfterCopyAttributeUnitToSelection(var ItemAttributeValueSelectionVar: Record "Item Attribute Value Selection" temporary; UnitofMeasure: Record "Unit of Measure")
begin
end;

OnAfterCopyAttributeToSelection(Record Item Attribute Value Selection, Record Item Attribute, Boolean) :#

Summary: Integration event that is raised after copying item attribute information to the attribute value selection record during attribute loading or selection processes, providing an extension point for implementing custom field mappings, additional data population, or business rule application when attributes are loaded into selection interfaces.

[IntegrationEvent(false, false)]
local procedure OnAfterCopyAttributeToSelection(var ItemAttributeValueSelectionVar: Record "Item Attribute Value Selection" temporary; ItemAttributePar: Record "Item Attribute"; FromLoadPar: Boolean): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSFCYItemAttributeMgt", 'OnAfterCopyAttributeToSelection', '', false, false)]
local procedure DoSomethingOnAfterCopyAttributeToSelection(var ItemAttributeValueSelectionVar: Record "Item Attribute Value Selection" temporary; ItemAttributePar: Record "Item Attribute"; FromLoadPar: Boolean)
begin
end;

Parameters:

  • ItemAttributeValueSelectionVar: Item Attribute Value Selection record (passed by reference) that has received the copied attribute information, allowing extensions to modify or enhance the selection data with additional information.
  • ItemAttributePar: Source Item Attribute record containing the original attribute definition and metadata that was copied to the selection, providing context for custom field mapping and additional data population logic.
  • FromLoadPar: Boolean value indicating whether the copy operation is part of an attribute loading process (true) or other selection operation (false), enabling different extension behavior based on the operation context.

OnSearchMasterDataForAttribute(RecordId, Integer, Boolean, Boolean) :#

Summary: Integration event that is raised during master data search operations for item attributes to determine if a specific attribute is used in related entities, providing an extension point for implementing custom search logic for additional table types or business entities not covered by standard Item, Item Category, and Item Variant searches.

[IntegrationEvent(false, false)]
local procedure OnSearchMasterDataForAttribute(ActualRecordID: RecordId; AttributeID: Integer; var Result: Boolean; var IsHandled: Boolean): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSFCYItemAttributeMgt", 'OnSearchMasterDataForAttribute', '', false, false)]
local procedure DoSomethingOnSearchMasterDataForAttribute(ActualRecordID: RecordId; AttributeID: Integer; var Result: Boolean; var IsHandled: Boolean)
begin
end;

Parameters:

  • ActualRecordID: RecordId of the entity being searched for attribute usage, providing context for table-specific search operations and enabling extensions to handle additional entity types.
  • AttributeID: Integer value specifying the attribute ID being searched for in master data relationships, enabling attribute-specific search logic and usage detection across different business entities.
  • Result: Boolean variable (passed by reference) that should be set to true by the extension if the attribute is found to be used in related entities, indicating whether the attribute has dependencies that prevent deletion or modification.
  • IsHandled: Boolean variable (passed by reference) that should be set to true by the extension if it has completely handled the master data search operation, preventing execution of standard search logic for unsupported table types.

OnBeforeGetUniqueMappingNoByRecordID(RecordId, Boolean, Code[20], Boolean) :#

Summary: Integration event that is raised before generating or retrieving a unique mapping number for item attribute value mappings based on record ID, providing an extension point for implementing custom mapping number generation logic or handling additional entity types not covered by standard Item, Item Category, Nonstock Item, Item Variant, and Item Version processing.

[IntegrationEvent(false, false)]
local procedure OnBeforeGetUniqueMappingNoByRecordID(SearchRecID: RecordId; JustSearchPar: Boolean; var ReturnNo: Code[20]; var IsHandled: Boolean): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSFCYItemAttributeMgt", 'OnBeforeGetUniqueMappingNoByRecordID', '', false, false)]
local procedure DoSomethingOnBeforeGetUniqueMappingNoByRecordID(SearchRecID: RecordId; JustSearchPar: Boolean; var ReturnNo: Code[20]; var IsHandled: Boolean)
begin
end;

Parameters:

  • SearchRecID: RecordId of the entity for which to generate or retrieve the unique mapping number, providing context for table-specific mapping logic and enabling extensions to handle additional entity types.
  • JustSearchPar: Boolean value indicating whether to only search existing mappings (true) or create missing entries (false), enabling different extension behavior based on the operation mode and data management requirements.
  • ReturnNo: Code[20] variable (passed by reference) that should contain the unique mapping number if found or generated by the extension, providing the identifier for attribute mapping operations.
  • IsHandled: Boolean variable (passed by reference) that should be set to true by the extension if it has completely handled the mapping number generation or retrieval, preventing execution of standard processing logic.

OnSetValuesFromItemAttributeIDValueMapping(Integer, Integer, Code[20], Code[20], Code[10], Code[20]) :#

Summary: Integration event that is raised during the extraction of item hierarchy information from item attribute variant version mapping records for table types not covered by standard processing, providing an extension point for implementing custom value extraction logic for additional entity types in specialized business scenarios.

[IntegrationEvent(false, false)]
local procedure OnSetValuesFromItemAttributeIDValueMapping(TableID: Integer; AttributeID: Integer; NoAsCode: Code[20]; var ItemNo: Code[20]; var VariantCode: Code[10]; var VersionCode: Code[20]): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSFCYItemAttributeMgt", 'OnSetValuesFromItemAttributeIDValueMapping', '', false, false)]
local procedure DoSomethingOnSetValuesFromItemAttributeIDValueMapping(TableID: Integer; AttributeID: Integer; NoAsCode: Code[20]; var ItemNo: Code[20]; var VariantCode: Code[10]; var VersionCode: Code[20])
begin
end;

Parameters:

  • TableID: Integer value specifying the table ID of the entity type being processed, enabling table-specific value extraction logic for custom entity types not handled by standard processing.
  • AttributeID: Integer value containing the attribute ID used for mapping record lookup in complex entity scenarios, providing context for attribute-specific value extraction operations.
  • NoAsCode: Code[20] value containing the primary identifier used for value extraction operations, providing the lookup key for retrieving hierarchy information from custom mapping structures.
  • ItemNo: Code[20] variable (passed by reference) that should receive the extracted item number from the custom mapping logic, enabling item context reconstruction for attribute management workflows.
  • VariantCode: Code[10] variable (passed by reference) that should receive the extracted variant code from the custom mapping logic, providing variant context for complex entity hierarchies.
  • VersionCode: Code[20] variable (passed by reference) that should receive the extracted version code from the custom mapping logic, enabling version context reconstruction for extended business scenarios.

OnBeforeCopyItemAttributeMappingFromItemToSpecificItem(RecordId, RecordId, Boolean) :#

Summary: Integration event that is raised before copying item attribute mappings from one entity to a specific target entity, providing an extension point for implementing custom copying logic, validation rules, or business constraints when propagating attribute assignments between related business entities in inheritance or synchronization scenarios.

[IntegrationEvent(false, false)]
local procedure OnBeforeCopyItemAttributeMappingFromItemToSpecificItem(FromRecordID: RecordId; ToRecordID: RecordId; var IsHandled: Boolean): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSFCYItemAttributeMgt", 'OnBeforeCopyItemAttributeMappingFromItemToSpecificItem', '', false, false)]
local procedure DoSomethingOnBeforeCopyItemAttributeMappingFromItemToSpecificItem(FromRecordID: RecordId; ToRecordID: RecordId; var IsHandled: Boolean)
begin
end;

Parameters:

  • FromRecordID: RecordId of the source entity from which attribute mappings will be copied, providing context for the source entity type and enabling source-specific copying logic.
  • ToRecordID: RecordId of the target entity that will receive the copied attribute mappings, enabling target-specific validation and business rule application during the copying process.
  • IsHandled: Boolean variable (passed by reference) that should be set to true by the extension if it has completely handled the attribute mapping copying operation, preventing execution of standard copying logic.