Monday, July 13, 2020
D365 – Data Entity Method Call Sequence
Thanks to Uwe Kruger for sharing this. I keep it here for my own reference.
https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/data-entities/validations-defaults-unmapped-fields
Thursday, November 7, 2019
Can’t stop DynamicsAXBatch service error
Admin User Provisioning Tool Error:
- If the Admin User Provisioning Tool gives error that can’t stop DynamicsAxBatch.
- Go to the Services,
- Find out the service with the name: Microsoft Dynamics 365 Unified Operations: Batch Management Service
- Stop it.
- Now register with the provisioning tool
- If you are unable to stop the DynamicsAxBatch Service. Then do the following steps in it:
- Click the Start menu
- Click Run or in the search bar type services.msc
- Press Enter
- Look for the service and check the Properties and identify its service name. Service name would be DynamicsAxBatch
- Once found, open a command prompt. Type: sc queryex [servicename].
- Press Enter
- Identify the PID
- In the same command prompt type: taskkill /f /pid [pid number]
- Press Enter
For reference, see the following picture:
Now start the service and and register yourself in the Admin Provisioning Tool.
Thursday, October 31, 2019
Using a tempDB table in a Query
static void TempDB(Args _args)
{
PurchLineMarkTmp tmpUnionedResult;
InventTable inventTable;
InventTableModule inventTableModule;
Query query;
QueryRun queryRun;
// Execute insert_recordset with TempDB table as a target
insert_recordset tmpUnionedResult(PurchLine)
select RecId from inventTable
exists join inventTableModule
where inventTableModule.ModuleType == ModuleInventPurchSales::Sales
&& inventTable.ItemId == inventTableModule.ItemId
&& inventTableModule.Price != 0;
query = new query();
query.addDataSource(tableNum(PurchLineMarkTmp));
queryRun = new QueryRun(query);
// Force queryRun to fetch from the right temporary table
queryRun.setRecord(tmpUnionedResult);
// Iterate all registered quantities
while (queryRun.next())
{
tmpUnionedResult = queryRun.get(tablenum(PurchLineMarkTmp));
info (strFmt('%1', tmpUnionedResult.PurchLine));
}
}
source: http://mafsarkhan.blogspot.com/2013/07/example-for-using-tempdb-table-in-query.html
Friday, May 31, 2019
Get Invoice Journal Id after posting Sales Invoice from multiple packing slips using X++
SalesFormLetter_Invoice SalesFormLetter;
TmpFrmVirtual tmpFrmVirtual;
List il;
;
il = new List(Types::Record);
// insert each packing slip RecId into the TmpFrmVirtual table
for (i = 1; i <= conlen(PScontainer); i++)
{
packingSlipRecId = conpeek(PScontainer, i);
custPackingSlipJour = custPackingSlipJour::findRecId(packingSlipRecId);
tmpFrmVirtual.NoYes = true;
tmpFrmVirtual.TableNum = custPackingSlipJour.TableId;
tmpFrmVirtual.RecordNo = custPackingSlipJour.RecId;
tmpFrmVirtual.Id = custPackingSlipJour.SalesId;
ttsBegin;
tmpFrmVirtual.insert();
ttsCommit;
// add record into the List
il.addEnd(tmpFrmVirtual);
}
// post invoice from multiple packing slips
salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice);
salesFormLetter.printFormLetter(false);
salesFormLetter.update(salesTable, systemDateGet(), SalesUpdate::PackingSlip, AccountOrder::None, false, false, false, false, il.pack());
// get the posted invoice journal recid
invoiceJourRecId = salesFormLetter.getOutputContract().parmJournal().RecId;
or get a container of posted journals
CustInvoiceTrans custInvTrans;
Set postedJournalList;
Set allPostedJournals = new Set(Types::Record);
SetEnumerator enumAllPostedJournal;
Set postedJournalTransList;
SetEnumerator enumPostedJournalTransList;
postedJournalList = Set::create(SysOperationHelper::base64Decode(salesFormLetter.getOutputContract().parmAllJournals()));
allPostedJournals = Set::union(allPostedJournals, postedJournalList);
postedJournalTransList = Set::create(SysOperationHelper::base64Decode(salesFormLetter.getOutputContract().parmJournalLines()));
enumPostedJournalTransList = postedJournalTransList.getEnumerator();
while(enumPostedJournalTransList.moveNext())
{
custInvTrans = enumPostedJournalTransList.current();
// process the data here
}
TmpFrmVirtual tmpFrmVirtual;
List il;
;
il = new List(Types::Record);
// insert each packing slip RecId into the TmpFrmVirtual table
for (i = 1; i <= conlen(PScontainer); i++)
{
packingSlipRecId = conpeek(PScontainer, i);
custPackingSlipJour = custPackingSlipJour::findRecId(packingSlipRecId);
tmpFrmVirtual.NoYes = true;
tmpFrmVirtual.TableNum = custPackingSlipJour.TableId;
tmpFrmVirtual.RecordNo = custPackingSlipJour.RecId;
tmpFrmVirtual.Id = custPackingSlipJour.SalesId;
ttsBegin;
tmpFrmVirtual.insert();
ttsCommit;
// add record into the List
il.addEnd(tmpFrmVirtual);
}
// post invoice from multiple packing slips
salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice);
salesFormLetter.printFormLetter(false);
salesFormLetter.update(salesTable, systemDateGet(), SalesUpdate::PackingSlip, AccountOrder::None, false, false, false, false, il.pack());
// get the posted invoice journal recid
invoiceJourRecId = salesFormLetter.getOutputContract().parmJournal().RecId;
or get a container of posted journals
CustInvoiceTrans custInvTrans;
Set postedJournalList;
Set allPostedJournals = new Set(Types::Record);
SetEnumerator enumAllPostedJournal;
Set postedJournalTransList;
SetEnumerator enumPostedJournalTransList;
postedJournalList = Set::create(SysOperationHelper::base64Decode(salesFormLetter.getOutputContract().parmAllJournals()));
allPostedJournals = Set::union(allPostedJournals, postedJournalList);
postedJournalTransList = Set::create(SysOperationHelper::base64Decode(salesFormLetter.getOutputContract().parmJournalLines()));
enumPostedJournalTransList = postedJournalTransList.getEnumerator();
while(enumPostedJournalTransList.moveNext())
{
custInvTrans = enumPostedJournalTransList.current();
// process the data here
}
Thursday, May 30, 2019
Convert from Transaction currency to Accounting currency
CurrencyExchangeHelper currencyExchangeHelper = CurrencyExchangeHelper::newExchangeDate(Ledger::current(), _invoicejournal.InvoiceDate);
lineCharges = currencyExchangeHelper.calculateTransactionToAccounting(_invoicejournal.CurrencyCode, lineCharges, true);
lineCharges = currencyExchangeHelper.calculateTransactionToAccounting(_invoicejournal.CurrencyCode, lineCharges, true);
Subscribe to:
Posts (Atom)
Import an ISV licese file into Dev environment using Power Shell
K:\AOSService\PackagesLocalDirectory\Bin\Microsoft.Dynamics.AX.Deployment.Setup.exe --setupmode importlicensefile --metadatadir K:\aosservi...
