Skip to main content

Notifications

Announcements

No record found.

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

  • Verified answer
    Mea_ Profile Picture
    60,278 on at
    RE: How to get Product Variants from AX Using X++

    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.

  • Community Member Profile Picture
    on at
    RE: How to get Product Variants from AX Using X++

    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,278 on at
    RE: How to get Product Variants from AX Using X++

    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
    RE: How to get Product Variants from AX Using X++

    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.

  • Mea_ Profile Picture
    60,278 on at
    RE: How to get Product Variants from AX Using X++

    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
    RE: How to get Product Variants from AX Using X++

    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,278 on at
    RE: How to get Product Variants from AX Using X++

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

  • Community Member Profile Picture
    on at
    RE: How to get Product Variants from AX Using X++

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

  • Mea_ Profile Picture
    60,278 on at
    RE: How to get Product Variants from AX Using X++

    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.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,112 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,893 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans