Here is the list of tools and resources available for developers working with the Dynamics AX 2012 Beta:
This blog is about daily challenges we normally faced in Dynamics 365 and Dynamics AX development.
Monday, April 18, 2011
Dynamics AX 2012 Hands on Labs
Here is the list of new enhancement made on Dynamics AX 2012 release:
Thats it !!!!!!!!!!!!!!!!!!
Thats it !!!!!!!!!!!!!!!!!!
Friday, April 15, 2011
Creating transfer order through X++ code
To create a transfer oder via a code:
inventTransferTable.clear();
inventTransferTable.initValue();
numberSequenceReference = InventParameters::numRefTransferId();
numberSeq =
numberSeq::newGetNumFromCode(numberSequenceReference.NumberSequence);
inventTransferTable.TransferId = numberSeq.num();
inventTransferTable.InventLocationIdFrom = fromloc;
inventTransferTable.modifiedField(fieldNum(InventTransferTable,InventLocationIdFrom));
inventTransferTable.InventLocationIdTo = toloc;
inventTransferTable.modifiedField(fieldNum(InventTransferTable,InventLocationIdTo));
inventTransferTable.TransferStatus = InventTransferStatus::Created;
inventTransferTable.insert();
inventTransferLine.clear();
inventTransferLine.initFromInventTransferTable(inventTransferTable,
NoYes::Yes);
nventTransferLine.ItemId = item;
inventTransferLine.initFromInventTable(InventTable::find(item));
inventTransferLine.QtyTransfer = qty_ship;
inventTransferLine.QtyShipNow = 0;
inventTransferLine.QtyReceiveNow = 0;
inventTransferLine.insert();
Also set the two fields:
QtyRemainShip and QtyRemainReceive to the value of QtyTransfer when you create the line.
inventTransferTable.clear();
inventTransferTable.initValue();
numberSequenceReference = InventParameters::numRefTransferId();
numberSeq =
numberSeq::newGetNumFromCode(numberSequenceReference.NumberSequence);
inventTransferTable.TransferId = numberSeq.num();
inventTransferTable.InventLocationIdFrom = fromloc;
inventTransferTable.modifiedField(fieldNum(InventTransferTable,InventLocationIdFrom));
inventTransferTable.InventLocationIdTo = toloc;
inventTransferTable.modifiedField(fieldNum(InventTransferTable,InventLocationIdTo));
inventTransferTable.TransferStatus = InventTransferStatus::Created;
inventTransferTable.insert();
inventTransferLine.clear();
inventTransferLine.initFromInventTransferTable(inventTransferTable,
NoYes::Yes);
nventTransferLine.ItemId = item;
inventTransferLine.initFromInventTable(InventTable::find(item));
inventTransferLine.QtyTransfer = qty_ship;
inventTransferLine.QtyShipNow = 0;
inventTransferLine.QtyReceiveNow = 0;
inventTransferLine.insert();
Also set the two fields:
QtyRemainShip and QtyRemainReceive to the value of QtyTransfer when you create the line.
Monday, April 11, 2011
Dynamics AX 2012 Developer papers is now available on MSDN
The developer documentation for Dynamics AX 2012 is now available on MSDN
Microsoft Dynamics AX 2012 Beta
Microsoft Dynamics AX 2012 Beta
Wednesday, April 6, 2011
Display all/specific AOT tables in a lookup
For displaying all/specific AOT objects like tables in the lookup control, we need to iterate the UtilidElements table with our desired criteria.
static void lookupAOTTables(FormStringControl _ctrl)
{
SysTableLookup sysTableLookup =
SysTableLookup::newParameters(tablenum(UtilidElements), _ctrl);
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange nameQBR, typeQBR;
;
sysTableLookup.addLookupfield(fieldnum(UtilidElements, Name));
sysTableLookup.addLookupfield(fieldnum(UtilidElements, Id));
queryBuildDataSource = query.addDataSource(tablenum
(UtilidElements));
nameQBR = queryBuildDataSource.addRange(fieldnum(UtilidElements,
name));
nameQBR.value('Cust*');
typeQBR = queryBuildDataSource.addRange(fieldnum(UtilidElements, recordType));
typeQBR.value(SysQuery::value(UtilElementType::Table));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
static void lookupAOTTables(FormStringControl _ctrl)
{
SysTableLookup sysTableLookup =
SysTableLookup::newParameters(tablenum(UtilidElements), _ctrl);
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange nameQBR, typeQBR;
;
sysTableLookup.addLookupfield(fieldnum(UtilidElements, Name));
sysTableLookup.addLookupfield(fieldnum(UtilidElements, Id));
queryBuildDataSource = query.addDataSource(tablenum
(UtilidElements));
nameQBR = queryBuildDataSource.addRange(fieldnum(UtilidElements,
name));
nameQBR.value('Cust*');
typeQBR = queryBuildDataSource.addRange(fieldnum(UtilidElements, recordType));
typeQBR.value(SysQuery::value(UtilElementType::Table));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
Friday, April 1, 2011
Count total number of records
To count number of records in a query, you just need check it through SysQuery::countTotal(QueryRun) and if the query have more than one data sources use SysQuery::countLoops(QueryRun) instead of SysQuery::countTotal(QueryRun).
Happy Daxing
Subscribe to:
Posts (Atom)