web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

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

Using Item Category Code in Logic

(0) ShareShare
ReportReport
Posted on by 60

Would someone please point me to documentation on how to incorporate Item Category Codes in to the Logic used in AL Code?

For example, "... if Item Category Code of "Gizmos", then table relationship = ... else ... "

As always, thanks in advance...

-Anthony

I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    92,382 Super User 2025 Season 2 on at
    RE: Using Item Category Code in Logic

    Hi, For multiple relationships in TableRelation, you can refer to the No. field on SalesLines.

    More details: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/properties/devenv-tablerelation-property

    pastedimage1659398232695v1.png

    For example,  for Item Category Code

    pastedimage1659398548065v2.png

    Hope this helps.

    Thanks.

    ZHU

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,037 Moderator on at
    RE: Using Item Category Code in Logic
    [quote user="antmas"]

    Thank you, Inge. I will take a look.

    [/quote]

    Please let me know if that was not a good enough sample and i can probably find some more.

    You f.ex. will find it also in the general journal line where account type will define what table account no. is related to.

  • Suggested answer
    Jeffrey Bulanadi Profile Picture
    8,431 on at
    RE: Using Item Category Code in Logic

    Hi Antmas,

     

    The purpose of item categories is mainly to help you sort and find items.

    https://docs.microsoft.com/en-us/dynamics365/business-central/inventory-how-categorize-items

     

    If you wish to see some samples codes that uses item category, You can go to at the below details

     

    Table 5722 - Item Category: It uses parenting and indentation logic.

    Codeunit 5722 - Item Category Management

     

    Item Category Relation to other tables

    https://dynamicsdocs.com/nav/2018/w1/table/item-category

     

    Please verify and like if you find my answer helpful. Have a nice day and thank you.

     

    Cheers,

  • antmas Profile Picture
    60 on at
    RE: Using Item Category Code in Logic

    Thank you, Inge. I will take a look.

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,037 Moderator on at
    RE: Using Item Category Code in Logic

    If you look at how they use Source Type and Source Code in the standard application. F.ex. in the Item Ledger Entry table. You will get a good sample there.

  • antmas Profile Picture
    60 on at
    RE: Using Item Category Code in Logic

    Vaishnavi, thank you for your reply.

    I am adding a custom field to the Item table with a relationship to other (custom table(s)).

    Which of these tables is related would depend on which of the Item Category Codes is selected.

    As I understand it, the data type of this ICC field is code, but when I attempt to make the relationship, I receive errors as it seems to want data type option. I've been successful using a workaround by using yet another custom field with options or enums and drive the relationship from that, but this approach doesn't seem very efficient. I'd like to use whatever I can of base functionality.

    thanks again

  • Suggested answer
    Vaishnavi J Profile Picture
    3,060 on at
    RE: Using Item Category Code in Logic

    Hi antmas ,

    Can you elaborate a bit more what is your requirement do you want to set some value or fetch some thing using Item category code and which table is needed?

    FYI Item category code is assigned in Item master.

    And if that item is used in Purchase and Sales documents then Item category code is set on their Purchase and Sales lines as well.

    If my answer was helpful to you, please verify it so that other users know it worked. Thank you very much

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 4,304

#2
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 4,045

#3
Sumit Singh Profile Picture

Sumit Singh 2,970

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans