Modify/ Update the Default Dimension in AX 2012 R3 Using X++ Code.
Modify/ Update the Default Dimension in AX 2012 R3 Using X++ Code.
static void RB_ModifyDimension(Args _args)
{
ItemId itemId;
str costCentre;
DimensionAttributeValueSetStorage dimStorage = new DimensionAttributeValueSetStorage();
DimensionAttribute dimAttribute;
DimensionAttributeValue dimAttributeValue;
DimensionDefault defaultDimension;
#define.CostCentre('CostCentre')
itemid = "TESTItem";
costCentre = '2000';
ttsBegin;
if (itemid && costCentre)
{
defaultDimension = InventTable::find(itemId).DefaultDimension;
dimStorage = DimensionAttributeValueSetStorage::find(defaultDimension);
dimAttribute = DimensionAttribute::findByName(#CostCentre);
dimAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAttribute, costCentre, true, true);
dimStorage.addItem(dimAttributeValue);
// Dimension modified or updated including costcentre as well.
defaultDimension = dimStorage.save();
info(strFmt("Modified/ Updated Default Dimension %1", defaultDimension));
}
ttsCommit;
}
X++ code to Merge & Update Sales Order & Sales Line Financial Dimension.
X++ code to update Sales Order & Sales Line Financial Dimension.
static void RB_SLineFinDimensionUpdate(Args _args)
{
SalesTable salesTable,salesTableUpd;
SalesLine salesLine,salesLineUpd;
CustAccount custAccount;
DimensionDefault defaultDimension,itemDefaultDimension,custDefaultDimension;
salesTable = SalesTable::find('10000');
salesLine = salesLine::find(salesTable.SalesId,1,true);
if (salesLine)
{
itemDefaultDimension = InventTable::find(salesLine.ItemId).DefaultDimension;
custDefaultDimension = CustTable::find(salesTable.CustAccount).DefaultDimension;
defaultDimension = DimensionDefaultingService::serviceMergeDefaultDimensions(custDefaultDimension,itemDefaultDimension);
update_recordSet salesTableUpd
setting defaultDimension = custDefaultDimension
where salesTableUpd.salesId == salesTable.SalesId;
update_recordSet salesLineUpd
setting defaultDimension = defaultDimension
where salesLineUpd.RecId == salesLine.RecId;
}
}
How to: Add Filter Controls to a Simple List Form [AX 2012 R3]
How to: Add Filter Controls to a Simple List Form [AX 2012 R3]
Step 1:Create a form filter
Step: 2
int selectionChange()
{
int ret;
ret = super();
QMPurchTable_ds.executeQuery();
return ret;
}
Step: 4
Write the below on FORM Datasource.
// If you are filtering used Enum Values. Please find the code below.
public void executeQuery()
{
AXStatus qmStatusExe; // EnumValue
// converting the string value to enum
qmStatusExe = str2enum(AXStatus,QMStatus.valueStr()); // values from the filter.
qr = SysQuery::findOrCreateRange(QMPurchTable_q.datasourceTable(tableNum(QMPurchTable)),fieldNum(QMPurchTable,QMStatus));
if (qmStatusExe == AXStatus::Open)
{
qr.value(queryValue(AXStatus::Open));
}
else if (qmStatusExe == AXStatus::Closed)
{
qr.value(queryValue(AXStatus::Closed));
}
else
{
qr.value(SysQuery::valueUnlimited());
}
qr.status(RangeStatus::Locked);
super();
}
Subscribe to:
Posts (Atom)
D365 F&O Release Pipeline Step by Step Configuration Without ISV's
Step-by-Step Guide: Creating D365FO Build and Deploy Pipelines Azure DevOps Build Pipeline I will walk through the standard procedures...
-
X++ code to read the Excel file static void RB_ReadExcel(Args _args) { SysExcelApplication application; SysExcelWorkbooks w...
-
//Create a new job and paste the code static void RB_ReadTextFile(Args _args) { Filename ...
-
// If the file path comes from the dialog , it automatically works ,else you need to Specify '\\' --------------------------------...