Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

How to Map Item attributes!!

(0) ShareShare
ReportReport
Posted on by

Is It possible to mapp item attribute values after creating  new item attributes like normal mapping

ItemR.Validate(Description, SMBItemStagingL.Designation);
I am try to create 100 items through a function and i have some item attribute so how can i map them
STEP1: I have created new item attribute values Item Attribute (7500) table 
STEP2:I have a setup page like inventory setup where i have mentioned the item attribute ID
STEP3: When i create new item through function is it possible to map the item attribute ..Any reference will be great,Thanks.
  • Pushparaj Profile Picture
    on at
    RE: How to Map Item attributes!!

    Hi what are this SMBitemstaging and SMBitemimportsetup?

    Are these Customized Table? If they are, then

    Make sure that the SMBItemStaging table has data that matches the "Reference" code passed to the SetItemAttributeValue procedure and Verify that the SMBImportSetup table has the correct setup for the "Diameter mm" attribute.

  • Community Member Profile Picture
    on at
    RE: How to Map Item attributes!!

    Thank you for your support,I copied the same procedure and run but now it doesnot show any changes,Do you I need to make any changes in your code 

    pastedimage1675434030517v1.png

    pastedimage1675434075619v2.png

  • Suggested answer
    Pushparaj Profile Picture
    on at
    RE: How to Map Item attributes!!

    Hi Can you Try The Below Written Code

    local procedure SetItemAttributeValue(Reference: code[20]; AttributeName: Text; AttributeValue: Variant)

       var

           ItemAttribute: Record "Item Attribute";

           ItemAttributeValueMap: Record "Item Attribute Value Mapping";

           ItemAttributeValue: Record "Item Attribute Value";

           SMBImportSetup: Record "SMB Import Setup";

           Item: Record Item;

           SMBItemStaging: Record "SMB Item Staging";

       begin

           if SMBItemStaging.Get(Reference) then begin

               if SMBImportSetup.Get() then begin

                   ItemAttribute.SetRange("Name", AttributeName);

                   if ItemAttribute.FindFirst() then begin

                       ItemAttributeValue.SetRange("Attribute Name", AttributeName);

                       if AttributeValue.IsInteger then

                      ItemAttributeValue.SetRange("Numeric Value", AttributeValue);

                       if AttributeValue.IsDecimal then

                      ItemAttributeValue.SetRange("Numeric Value", AttributeValue);

                       if AttributeValue.IsText then

                      ItemAttributeValue.SetRange("Value", AttributeValue);

                       if not ItemAttributeValue.FindFirst() then begin

                           ItemAttributeValue.Init();

                           ItemAttributeValue."Attribute ID" := ItemAttribute.ID;

                           ItemAttributeValue."Attribute Name" := ItemAttribute.Name;

                           if AttributeValue.IsInteger then

                          ItemAttributeValue."Numeric Value" := AttributeValue;

                           if AttributeValue.IsDecimal then

                          ItemAttributeValue."Numeric Value" := AttributeValue;

                           if AttributeValue.IsText then

                          ItemAttributeValue.Value := AttributeValue;

                           ItemAttributeValue.Insert(true);

                       end;

                       ItemAttributeValueMap.Init();

                       ItemAttributeValueMap."Table ID" := 27;

                       ItemAttributeValueMap."No." := SMBItemStaging.Reference;

                       ItemAttributeValueMap."Item Attribute ID" := ItemAttribute.ID;

                       ItemAttributeValueMap."Item Attribute Value ID" := ItemAttributeValue.ID;

                       ItemAttributeValueMap.Insert(true);

                   end;

               end;

           end;

       end;

  • Community Member Profile Picture
    on at
    RE: How to Map Item attributes!!

    Now The item attributes caption is coming while creating item I dont understand why the value is coming not , Any idea where I went wrong.

    pastedimage1675422223017v2.png

         

     local procedure SetItemAttibuteValue(Reference: code[20])
        var
            ItemAttributeL: Record "Item Attribute";
            ItemAttributeValueMap: Record "Item Attribute Value Mapping";
            ItemAttributeValue: Record "Item Attribute Value";
            SMBImportSetupL: Record "SMB Import Setup";
            ItemL: Record Item;
            SMBItemStagingL: Record "SMB Item Staging";
            DiameterIntegerL: Integer;
        begin
            IF SMBItemStagingL.Get(Reference) THEN BEGIN
                if SMBImportSetupL.Get() then begin
                    //Diameter:
                    SMBImportSetupL.TestField("Diameter mm");
                    Evaluate(DiameterIntegerL, SMBItemStagingL."Diameter mm");
                    SetAttribute(SMBItemStagingL.Reference, SMBImportSetupL."Diameter mm", DiameterIntegerL, 0, '');
                end
            end;
        end;
        
          local procedure SetAttribute(ItemNoV: Code[20]; AttributeIDV: integer; IntegerValueV: Integer; DecimalValueV: Decimal; TextValueV: Text)
        var
            ItemAttributeL: Record "Item Attribute";
            ItemAttributeValueMap: Record "Item Attribute Value Mapping";
            ItemAttributeValue: Record "Item Attribute Value";
            SMBImportSetupL: Record "SMB Import Setup";
            ItemL: Record Item;
            SMBItemStagingL: Record "SMB Item Staging";
            DiameterIntegerL: Integer;
            StrapIntegerL: Integer;
        begin
            if SMBImportSetupL.Get() then begin
                ItemAttributeL.Get(SMBImportSetupL."Diameter mm");
                ItemAttributeValue.SetRange("Attribute ID", AttributeIDV);
                if IntegerValueV <> 0 then
                    ItemAttributeValue.SetRange("Numeric Value", DiameterIntegerL);
                if DecimalValueV <> 0 then
                    ItemAttributeValue.SetRange("Numeric Value", DecimalValueV);
                if TextValueV <> '' then
                    ItemAttributeValue.SetRange(Value, TextValueV);
                if not ItemAttributeValue.FindFirst() then begin
                    ItemAttributeValue.Init();
                    ItemAttributeValue."Attribute ID" := ItemAttributeL.ID;
                    ItemAttributeValue."Attribute Name" := ItemAttributeL.Name;
                    if IntegerValueV <> 0 then
                        ItemAttributeValue."Numeric Value" := DiameterIntegerL;
                    if DecimalValueV <> 0 then
                        ItemAttributeValue."Numeric Value" := DiameterIntegerL;
                    if TextValueV <> '' then
                        ItemAttributeValue.Value := TextValueV;
                    ItemAttributeValue.Insert(true);
                end;
                ItemAttributeValueMap.Init();
                ItemAttributeValueMap."Table ID" := 27;
                ItemAttributeValueMap."No." := ItemNoV;
                ItemAttributeValueMap."Item Attribute ID" := ItemAttributeL.ID;
                ItemAttributeValueMap."Item Attribute Value ID" := ItemAttributeValue.ID;
                ItemAttributeValueMap.Insert(true);
            end;
        end;
    

  • Suggested answer
    YUN ZHU Profile Picture
    82,747 Super User 2025 Season 1 on at
    RE: How to Map Item attributes!!

    Hi, You need to pay attention to the following table. Item and Item Attribute are related through this table.

    table 7505 "Item Attribute Value Mapping"

    pastedimage1675128141319v1.png

    pastedimage1675128180402v2.png

    Hope this helps.

    Thanks.

    ZHU

  • Community Member Profile Picture
    on at
    RE: Item attributes!! can we customize them

    Thanks for the reply, but here it shows only the functional part, but how we can map the item attribute for multiple records how to  manually add them 

    ITEM NO Diameter length width height
    101 ABC 1 3 2
    102 ACB 2 2 3
    103 BAC 3 1 1

    If I create these item through a function how can insert attribute and mapp them

  • Suggested answer
    DAnny3211 Profile Picture
    9,276 Moderator on at
    RE: Item attributes!! can we customize them

    hi

    look this

    learn.microsoft.com/.../inventory-how-work-item-attributes

    DAniele

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
YUN ZHU Profile Picture

YUN ZHU 448 Super User 2025 Season 1

#2
Sagar Dangar, MCP Profile Picture

Sagar Dangar, MCP 358

#3
Mansi Soni Profile Picture

Mansi Soni 327

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans