Microsoft Dynamics AX Support

This blog contains posts by the Microsoft Dynamics AX Support Teams Worldwide

Calling the InventTransferJournalService in AX 2012

I received a question on how to call this service.  The code below creates an inventory transfer journal for me in the demo data:

TransferJournalServiceClient client = new TransferJournalServiceClient();

CallContext context = new CallContext();

           
context.Company = “ceu”;

 

AxdTransferJournal journal = new AxdTransferJournal();

AxdEntity_InventJournalTable journalHeader = new AxdEntity_InventJournalTable();

journalHeader.JournalNameId = “ITrf”;

 

AxdEntity_InventJournalTrans inventJournalTrans = new AxdEntity_InventJournalTrans();

inventJournalTrans.ItemId = “1000”;

           

AxdEntity_InventDimIssue inventDimIssue = new AxdEntity_InventDimIssue();

inventDimIssue.InventSiteId = “2”;

inventDimIssue.InventLocationId = “21”;

inventJournalTrans.InventDimIssue = new AxdEntity_InventDimIssue[1] { inventDimIssue };

 

AxdEntity_InventDimReceipt inventDimReceipt = new AxdEntity_InventDimReceipt();

inventDimReceipt.InventSiteId = “1”;

inventDimReceipt.InventLocationId = “11”;

inventJournalTrans.InventDimReceipt = new AxdEntity_InventDimReceipt[1] { inventDimReceipt };

           

           
journalHeader.InventJournalTrans = new AxdEntity_InventJournalTrans[1] {inventJournalTrans };

           
journal.InventJournalTable = new AxdEntity_InventJournalTable[1] { journalHeader };

 try

{             
  client.create(context, journal);

}

catch (Exception e)

{               
string error = e.Message;

Console.ReadLine();

}