Following is the sample job to show how we can create and post movement journal by making use of available api's in the Dynamics Ax.
static void createMovJournal(Args _args)
{ InventJournalTable journalTable;
InventJournalTrans journalTrans;
InventJournalTableData journalTableData;
InventJournalTransData journalTransData;
InventTable inventTable;
InventDim inventDim;
Counter cnt;
InventJournalCheckPost journalCheckPost = new InventJournalCheckPost();
;
journalTableData = JournalTableData::newTable(journalTable);
journalTransData = journalTableData.journalStatic().newJournalTransData(journalTrans,journalTableData);
// Init JournalTable
journalTable.clear();
journalTable.JournalId = journalTableData.nextJournalId();
journalTable.JournalType = InventJournalType::Movement;
journalTable.JournalNameId = journalTableData.journalStatic().standardJournalNameId(journalTable.JournalType);
journalTableData.initFromJournalName(journalTableData.journalStatic().findJournalName(journalTable.JournalNameId));
// Init JournalTrans
select firstonly inventTable;
for(cnt=1;cnt<10;cnt++)
{
journalTrans.clear();
journalTransData.initFromJournalTable();
journalTrans.TransDate = systemdateget() + 1 div 2;
journalTrans.ItemId = inventTable.ItemId;
journalTrans.Qty = 100;
journalTrans.CostAmount = 100;
// Dimension details
inventDim.InventLocationId = 'GW';
journalTrans.InventDimId = InventDim::findOrCreate(inventDim).inventDimId;
journalTransData.create();
}
journalTable.insert();
// Call the static method to post the journal
if(InventJournalCheckPost::newPostJournal(journalTable).validate())
InventJournalCheckPost::newPostJournal(journalTable).run();
}
Hi AX Devs,
ReplyDeleteAny body who know how will I get value from xml Only i get the first Node using my code below but I was not able to get the Name or if i am using .innerText i use to get the whole record as "0001Vendor0001" my objective is that I should able to separate the two field to present such as "0001 - Vendor0001".
Thanks in advance. Below sample of my code.
/*-------------X M L File------------
0001
Vendor0001
-------------------------------------
*/
XMLNode rootNode;
XmlNodeList xmlnodelist;
;
//location iniated here then
rootNode = doc.documentElement();
xmlnodelist =doc.documentElement().childNodes();
do
{
noderec = xmlnodelist.nextNode();
print noderec.innerText();
}
while(noderec);
im sorry..i should not post comment here.This is not the comment for the subject above.
ReplyDeleteHi, I'm new to customizing ax and I have a challenge to start me off.
ReplyDeleteI would like to add the post functionality to 'Enter Customer Payments' form so as to enable posting of a single payment to matched invoices directly rather than having to go back to the journal window to post it there.
Could you give me any direction???
Regards.