Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Customise the lookup of default dimension values

Posted on by 2,650

Hi,

Does anyone happen to know the exact form or class to customise the output of a lookup on a default dimension?

I have added a custom field to the DimensionAttributeValue table and I now want to use this field as a range value in whatever query is used to retrieve all dimension values for a particular dimension.

So far I've been examining the SysLookup class and method lookupDimension - it appears to point towards the form DimensionDefaultingLookup but within this form I am struggling to find where I can edit the query range as it doesn't reference the DimensionAttributeValue table.

All help greatly appreciated.

*This post is locked for comments

  • Verified answer
    Maciej Obojski Profile Picture
    Maciej Obojski 610 on at
    RE: Customise the lookup of default dimension values

    Hi Kauto,

    looking into my application (standard AX 2012 R3 demo), I can see below code in the closeSelect method of 'DimensionDefaultingLookup form.

    The code, as you will see (for Russian functionality at least) will look for the DimensionAttributeValue record, which represents selected dimension:

    public void closeSelect(str _selectString)

    {

       DimensionAttributeValue     dimAttrValue;

       boolean                     valueFound;

       // <GEERU>

       if(!canSelect)

       {

           return;

       }

       // </GEERU>

       super(_selectString);

       // Pass the currently selected value and recid back to the controller if it exists

       if (controller != null)

       {

           valueFound = false;

           if (strLen(_selectString) > 0)

           {

               // Get the associated dimension attribute value

               changecompany (dimAttr.company())

               {

                   // <GEERU>

                   dimAttrValue = DimensionAttributeValue::findByDimensionAttributeAndEntityInst(dimAttr.RecId, ds.(dimAttrViewContract.parmKeyFieldId()), false, true);

                   // </GEERU>

               }

               if (dimAttrValue)

               {

                   controller.setDimensionAttributeValue(dimAttr, dimAttrValue.RecId, _selectString);

                   valueFound = true;

               }

           }

           if (!valueFound)

           {

               // No value was selected, clear out the existing value

               controller.setDimensionAttributeValue(dimAttr, 0, '');

           }

       }

    }

    You could potentially try using the logic inside the 'findByDimensionAttributeAndEntityInst' method, but there is a point to consider: there might not exist records in DimensionAttributeValue  table at the time of performing lookup.

    Let me know if this helped you by any means,

    Maciej

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,104 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans