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