Use the below job for updating financial dimensions for sales table and lines.
AX 2012 code
----------------------
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;
}
}
D365 Code
-------------------
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 = LedgerDimensionDefaultFacade::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;
}
}
@Rahul
AX 2012 code
----------------------
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;
}
}
D365 Code
-------------------
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 = LedgerDimensionDefaultFacade::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;
}
}
@Rahul
initial public offering services
ReplyDelete