Skip to main content

Notifications

Business Central forum
Suggested answer

Using Item Category Code in Logic

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

Categories:
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 69,612 Super User 2024 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
    Inge M. Bruvik 32,744 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
    Jeffrey Bulanadi 644 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
    antmas 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
    Inge M. Bruvik 32,744 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
    antmas 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
    Vaishnavi J 3,056 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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,524 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,469 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans