Hi there,
first, I have to tell I'm new in AX (started 3 weeks ago) and I'm not english speaker so sorry for that.
I'm doing a form to transfer item from one wmsLocation to another without using the implemented solution (so the final user can do it faster, no need to precise all information that dont change).
I've done my form all is ok but now it's time to post the result in the inventory transfer journal. I have found some code on web (https://community.dynamics.com/ax/b/axaptavsme/archive/2013/07/17/inventory-transfer-journal-through-x-code) and all exemple I found are exactly the same (the one linked).
The problem is compiler tell me there is an error in this code and I cant debug because I dont really understand all this code and I didnt found any explanation about "how build journal entry in code", only found this code without comment.
ttsbegin;
inventJournalTable.clear();
num = new NumberSeq();
num = NumberSeq::newGetNum(InventParameters::numRefTransferId());
inventJournalTable.initFromInventJournalName(InventJournalName::find(InventParameters::find().TransferJournalNameId));
inventJournalTable.Description = "Inventory Transfer Journal";
inventJournalTable.SystemBlocked = true;
inventJournalTable.insert();
inventJournalTrans.clear();
inventJournalTrans.initFromInventJournalTable(inventJournalTable);
inventJournalTrans.ItemId = CtrlItemId.text();
frominventDim.InventLocationId = CtrlLocId.text();
frominventDim.inventSiteId = CtrlSiteId.text();
frominventDim.wMslocationid = CtrlLocFrom.text();
toInventDim.InventLocationId = CtrlLocId.text();
toInventDim.InventSiteId = CtrlSiteId.text();
toInventDim.wmslocationid = CtrlLocTo.text();
toInventDim = InventDim::findOrCreate(ToinventDim);
frominventDim = InventDim::findOrCreate(frominventDim);
inventJournalTrans.InventDimId = frominventDim.inventDimId;
inventJournalTrans.initFromInventTable(InventTable::find("1101"));
inventJournalTrans.Qty = CtrlQty.value(); //Insert qty
inventJournalTrans.ToInventDimId = ToinventDim.inventDimId;
inventJournalTrans.TransDate = SystemDateget();
inventJournalTrans.insert();
inventJournalCheckPost = InventJournalCheckPost::newJournalCheckPost(JournalCheckpostType::Post,inventJournalTable);
//inventJournalCheckPost.parmThrowCheckFailed(_throwserror);
//inventJournalCheckPost.parmShowInfoResult(_showinforesult);
inventJournalCheckPost.run();
inventJournalTable.SystemBlocked = false;
inventJournalTable.update();
ttscommit;
so my first question is : has anybody any idea what is wrong with the red line ?
Here is the compiler output (in french)
It says something like : "Operand types are not compatible with the operator."
Second question : Can anybody explain this code or the logical process to use this Journal so I can understand and increase my skill in AX and not just copy pastaaaaaa.
Thank you a lot for help ! :)