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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to get Product Variants from AX Using X++

(0) ShareShare
ReportReport
Posted on by

Hello there,

I need help in getting the Variants of a Product from AX using X++. I also need the dimensions of the particular variant and uniquevariantid, I have no idea how to go about this, any help would be appreciated.

Regards,

Faizan Batra

*This post is locked for comments

I have the same question (0)
  • Mea_ Profile Picture
    60,286 on at

    Hi FaizanBatra,

    Table InventDimCombination contains 3 fields: ItemId, InventDImId and DistinctProductVariant. So it links item and inventory dimensions with variant.

    Using findByDistinctProductVariant() you can find record by variant and using find() you can find record by item and inventDIm.

  • Community Member Profile Picture
    on at

    I'm sorry, please can you help me? I need a detailed answer, I'm relatively new to AX

  • Mea_ Profile Picture
    60,286 on at

    Can you then give us more details, what exactly you want to achieve and what is your issue ?

  • Community Member Profile Picture
    on at

    Okay so simple product is alright, i can get it but when i create a variant, I get a variant id and it's dimensions, now i am looking forward to get that information.

  • Mea_ Profile Picture
    60,286 on at

    Do you have some x++ code already ?

    It's hard to understand from one sentence what exactly are you doing and what is you problem. Do you have item id and inventory dimensions ? what are you going to do with this variant ?

  • Community Member Profile Picture
    on at

    Okay so the dimensions are like size,color and weight and yes i have the itemid with me.So i want to provide itemid and get all variants associated(variant id and dimensions(size,color,weight)) i hope you understand now.

    I will just print it in info.

  • Verified answer
    Mea_ Profile Picture
    60,286 on at

    Here you go

    InventDimCombination inventDimCombination;

    InventDim                     inventDim;

    while select inventDimCombination

       where inventDimCombination.ItemId == '1000'

          join inventDim

              where inventDim.inventDimId == inventDimCombination.InventDimId

      {

          info(strFmt('%1 : %2 : %3 : %4 : %5',

                 inventDimCombination.DistinctProductVariant,

                 inventDim.configId,

                 inventDim.InventColorId,

                 inventDim.InventSizeId,

                 inventDim.InventStyleId));      

      }

  • Community Member Profile Picture
    on at

    Why does InventDimCombination have limited products and InventTable have all the products? How do i get all master products?

  • Verified answer
    Mea_ Profile Picture
    60,286 on at

    You asked how to get variant and product dimensions so this code will give you exactly what you asked.

    There are 2 types of products in AX: products and master products.

    Inventtable contain all released products to current legal entity, master products + products.

    inventDimCombination contains only master products, where itemid is a master product and DistinctProductVariant is a variant.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Sagar Suman Profile Picture

Sagar Suman 2 Super User 2026 Season 1

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans