Hello All - I'm creating a sales order for a specific retail store using X and getting below mentioned error, please help me to fix this.
retailChannelTbl.clear(); select DefaultDimension from retailChannelTbl where retailChannelTbl.INVENTLOCATION == inventLocation.InventLocationId; dimAttrCCValue = CfzSalesOrderDataProvider::getDimensionDisplayValue(retailChannelTbl.DefaultDimension, 'CC'); dimAttr = DimensionAttribute::findByName('CC'); dimAttrValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAttr, dimAttrCCValue, false, true); if (dimAttrValue) { dimavss.addItem(dimAttrValue); } /***********************************************************************/ dimAttrCCValue = CfzSalesOrderDataProvider::getDimensionDisplayValue(retailChannelTbl.DefaultDimension, 'BC'); dimAttr = DimensionAttribute::findByName('BC'); dimAttrValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAttr, dimAttrCCValue, false, true); if (dimAttrValue) { dimavss.addItem(dimAttrValue); } /***********************************************************************/ dimAttrCCValue = CfzSalesOrderDataProvider::getDimensionDisplayValue(inventTable.DefaultDimension, 'CAT'); dimAttr = DimensionAttribute::findByName('CAT'); dimAttrValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAttr, dimAttrCCValue, false, true); if (dimAttrValue) { dimavss.addItem(dimAttrValue); } /***********************************************************************/ dimAttrCCValue = CfzSalesOrderDataProvider::getDimensionDisplayValue(retailChannelTbl.DefaultDimension, 'RC'); dimAttr = DimensionAttribute::findByName('RC'); dimAttrValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAttr, dimAttrCCValue, false, true); if (dimAttrValue) { dimavss.addItem(dimAttrValue); } salesLine.DefaultDimension = dimavss.save();
and the body of the function getDimensionDisplayValue is below
public static str getDimensionDisplayValue(RecId defaultDimension, Name dimName) { DimensionAttributeValueSetStorage dimStorage; dimStorage = DimensionAttributeValueSetStorage::find(defaultDimension); return dimStorage.getDisplayValueByDimensionAttribute(DimensionAttribute::findByName(dimName).RecId); }
The problem is related to data in database, therefore the answer to "why this message didn't occurs on DEV environment" looks simple: because you have different data there.
You didn't answer my question about the value. What value do you you pass to getDimensionDisplayValue() (= which value do you have retailChannelTbl.DefaultDimension)? Do you have such a value in DimensionFinancialTag table?
I moved the thread from Dynamics AX Forum to Dynamics 365 Finance Forum. I also fixed the indentation for you - please pay more attention to it next time.
Hello Martin, Thanks for reply. The F&O version for UAT(Sandbox) environment is 10.0.30 and for DEV environment 10.0.27
The line number 5 in first code snippet throw the error. which is below:
dimAttrCCValue = CfzSalesOrderDataProvider::getDimensionDisplayValue(retailChannelTbl.DefaultDimension, 'CC');
and yes that is the message I got in UAT(Sandbox) environment. But the thing if something is wrong than why this message didn't occurs on DEV environment.
Code indent is mistakenly done, apologize.
Which version is it about? It seems to be either AX 2012 or F&O.
Which line of code does throw the error? What value are you looking for? Isn't the message right when saying that no such a record exists in DimensionFinancialTag table?
By the way, is it really needed to indent code in your first snippet by 36 spaces?
André Arnaud de Cal...
291,996
Super User 2025 Season 1
Martin Dráb
230,853
Most Valuable Professional
nmaenpaa
101,156