Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

AX 2012. Check if a product configuration exists. X++

(0) ShareShare
ReportReport
Posted on by 2,987

In AX4, we could easily check if a configuration existed for an Item. We could simply do

if (ConfigTable::find(_ItemId,value) ...


Now with the new design in AX 2012, it seems that we must find all configuration RecIDs in the EcoResProductMasterConfiguration and then loop through them and find each RecID in EcoResConfiguration

Something like 

while select EcoResProductMasterConfiguration where EcoResProductMasterConfiguration.ConfigProductMaster == InventTable::find(_ItemId).Product
{
configId = EcoResConfiguration::find(EcoResProductMasterConfiguration.Configuration).Name;
if configId == value ..
}

I was wondering if there is any helper class that would make the job easier. I found a class named EcoResEcoResProduct_EcoResConf, but can't figure out if it could help in this task.

 

At the end what I would like is a fast way to check if a configuration name exists for a product

*This post is locked for comments

  • sureshch Profile Picture
    sureshch 20 on at
    RE: AX 2012. Check if a product configuration exists. X++

    Hi Ghetz

    The above will provide all the configuration but  not the released product variants .

    For the released product variants you can use the below code

    InventDimCombination inventDimCombination;

    InventDim                     inventDim;

    while select inventDimCombination

      where inventDimCombination.ItemId == 'e0402e'

         join inventDim

             where inventDim.inventDimId == inventDimCombination.InventDimId

     {

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

                inventDimCombination.DistinctProductVariant,

                inventDim.configId,

                inventDim.InventColorId,

                inventDim.InventSizeId,

                inventDim.InventStyleId));

     }

  • Ghetz Profile Picture
    Ghetz 2,987 on at
    RE: AX 2012. Check if a product configuration exists. X++

    Thank you! this method was really helpful

    First I didn't know how to get the productDimensionAttribute. I finally found out and used it like this:

    if(!EcoResProductMasterConfiguration::existByProductConfiguration(InventTable::find(_ItemId).Product,EcoResProductDimensionAttribute::inventDimFieldId2DimensionAttributeRecId(fieldNum(InventDim, ConfigId)),EcoResConfiguration::findByName(value).RecId))


    You have similar functions available for all other dimensions:

    EcoResProductMasterSize::existByProductSize
    EcoResProductMasterColor::existByProductColor

  • Suggested answer
    Sohaib Cheema Profile Picture
    Sohaib Cheema 46,614 User Group Leader on at
    RE: AX 2012. Check if a product configuration exists. X++

    InventTable(Table) >> hasConfigs(method)

    InventTable.hasConfigs()

  • Verified answer
    nunomaia Profile Picture
    nunomaia 11 Moderator on at
    RE: AX 2012. Check if a product configuration exists. X++

    !EcoResProductMasterConfiguration::existByProductConfiguration(_productMaster, _productDimensionAttribute, _configurationRecId))

    Does this solves your needs  ?

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans