Showing posts with label Local Service. Show all posts
Showing posts with label Local Service. Show all posts

Thursday, January 5, 2012

Calling the InventTransferJournalService in AX 2012

The following is the code (written by Becky Newel from Microsoft) to call the InventTransferJournalJournalService in AX 2012.

TransferJournalServiceClient client = new TransferJournalServiceClient();
CallContext context = new CallContext();
AxdTransferJournal journal = new AxdTransferJournal();
AxdEntity_InventJournalTable journalHeader = new AxdEntity_InventJournalTable();
AxdEntity_InventJournalTrans inventJournalTrans = new AxdEntity_InventJournalTrans();


journalHeader.JournalNameId = "ITrf";
inventJournalTrans.ItemId = "1000";
context.Company = "ceu";


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();
}


Take Care!

Tuesday, July 26, 2011

Friday, July 15, 2011

SubStr function - Axapta

str SubStr (str _text, int _position, int _chars)

SubStr("MyString",20,3);  // Returns ""
SubStr("MyString ",4,50);  // Returns "tring"

Monday, July 11, 2011

Create loop from an AX form DataSet - Ax 2009

Sometimes we need to loop through values at the form level. The following code loops (for loop) the SalesParmTable in the CloseOk() Form method.        


        //Create Lines
        for (localSalesParmTable = salesParmTable_ds.getFirst();
              localSalesParmTable;
              localSalesParmTable = salesParmTable_ds.getNext())
        {

              ....Implementation....
        }

Friday, May 6, 2011

Error while trying to access Active Directory - AX 2009 -

Today I was trying to add some users by using the Microsoft Dynamics AX 2009  Active Directory Import Wizard and I got the following error:



Error while trying to access Active Directory

I went into a code (Forms/SysUserADUserImportWizard/searchADUser) and I saw that the Active Directory searcher will break into this line:

searchResultCollection = directorySearcher.FindAll();