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...
Answered

Item attributes

(0) ShareShare
ReportReport
Posted on by 555

Hi experts,

I have made an extension to Business Central cloud.

On my own table, I would like to have a field, where the user can select one of the item attributes and save the selected item attribute on my table.

The problem is that item attributes have an integer as unique key and I only want my user to see the name of the item attribute, when he/she selects it.

For instance, if I have these item attribute records:

1, Weight

2, Color

3 Height

then I want the user to select between Weight, Color and Height and it must only be the selected value (eg. "Color"), that is shown in my new field on my new table.

How do I do that?

I have these two files:

table 50101 "myTable"
{
    Caption = 'my';

    fields
    {
        field(1CodeCode[10])
        {
            Caption = 'Code';
            NotBlank = true;
        }
        field(2; Description; Text[50])
        {
            Caption = 'Desc.';
        }
        field(3; "Item Attribute 1"; Integer)
        {
            Caption = 'No. 1';
            TableRelation = "Item Attribute".ID;
        }
    }

    keys
    {
        key(Key1; Code)
        {
            Clustered = true;
        }
    }
}
Page 50102 "myPage"
{
    Caption = 'Well';
    PageType = List;
    SourceTable = myTable;
    ApplicationArea = All;
    UsageCategory = Lists;

    layout
    {
        area(content)
        {
            repeater(Group)
            {
                field("Code";Rec.Code)
                {
                    ApplicationArea = All;
                    ToolTip = 'Well';
                }

                field(Description;Rec.Description)
                {
                    ApplicationArea = All;
                    ToolTip = 'Well';
                }                

                field("Item Attribute 1";Rec."Item Attribute 1")
                {
                    ApplicationArea = All;
                    ToolTip = 'Well';
                }
            }
        }
    }
}


  • Morten Steengaard Profile Picture
    555 on at
    RE: Item attributes

    Hi Josh,

    Thank you very much for your reply.

    I looked at the page, you suggested, and now it works fine.

    I made the field without a tablerelation:

           field(3; "Item Attribute 1"; Text[250])

           {

               Caption = 'Name';

               trigger OnValidate()

               var

                   ItemAttribute: Record "Item Attribute";

               begin

                   if Rec."Item Attribute 1" <> '' then begin

                       ItemAttribute.SetRange(Name, "Item Attribute 1");

                       if not ItemAttribute.FindFirst() then begin

                           Error('It did not exist");

                       end;

                       if Rec."Item Attribute 1" <> ItemAttribute.Name then

                           Rec."Item Attribute 1" := ItemAttribute.Name;

                   end;

               end;

           }

    and on my page, I wrote this:

                   field("Item Attribute 1";Rec."Item Attribute 1")

                   {

                       ApplicationArea = All;

                       ToolTip = 'Name';

                       TableRelation = "Item Attribute".Name;

                   }

  • Suggested answer
    JAngle Profile Picture
    89 on at
    RE: Item attributes

    Have a look at page 7506 "Filter Items by Attribute". That one doesn’t show the integer. It is used to return an item filter but you could use it as a basis for adding data to your table. Note it has a trigger built in to it: trigger OnQueryClosePage(CloseAction: Action): Boolean

    I’d take a copy and use it as you need. It passes a temporary version of the table Filter Item Attributes Buffer.

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 446 Super User 2025 Season 1

#2
Sagar Dangar, MCP Profile Picture

Sagar Dangar, MCP 339

#3
Mansi Soni Profile Picture

Mansi Soni 320

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans