Showing posts with label Axapta. Show all posts
Showing posts with label Axapta. Show all posts

Monday, August 31, 2015

Delete all transactions Ax2012

There is a class named "SysDatabaseTransDelete" in Axapta which can be used to delete all the transactions from your Ax Db but will not delete the base setups. In that case we can use the same DB as Production Db.
NOTE: It works perfectly with Ax2012 CU3 and above as it is now updated for new DB structure. Otherwise you may face issues with General Journal/Trial balance data.
It deletes all data from tables in the Transaction, WorksheetHeader and WorksheetLine table groups plus the following tables...
       SalesTable
       PurchTable
       WMSPallet
       CustInterestJour
       CustCollectionLetterJour
       ProjControlPeriodTable
       ProjInvoiceJour
       ProjJournalTable
       PdsRebateTable
       PdsBatchAttributes
You can run it from the AOT by right clicking on the SysDatabaseTransDelete class node and selecting "open" - this isn't the sort of thing you would want to put on a menu anywhere.
Here is a job for the same:
static void deleteTransactions(Args _args)
{
SysDatabaseTransDelete delete;
;
delete = new SysDatabaseTransDelete();
delete.run();
}

Saturday, September 14, 2013

CryptoAPI not available

You have set up a new Microsoft Dynamics AX environment and everything works fine but EP(Enterprise Portal). The only thing Event Viewer(eventvwr) says is "CryptoAPI not available". So it's time to check the Business Connector user account under "System Administration->Setup->System->System service accounts" or Application Pool identity of the EP site using Sharepoint Central Administration.

The bcproxy account is either not setup properly or not assigned in AX or in sharepoint. Remember bcproxy account should be a same domain account. So you just need to assign it and you have got your EP back :)

You are not recognized as a recognized user of Microsoft Dynamics Ax

You may this error when you have to import an AX database from some other environment of different domain e.g. your client's DB. In this case once you import the db and start Ax, it will throw the following error:








Now this happens because of the change in domain(new domain and users are not logged in AX DB) so we need to add users of our domain to this DB. For this we need to add an entry with SID of our "Admin" account to the "USERINFO" table.



Follow the steps:
  1. Get the SID of Admin account.
  • You can also get SID from an existing AX DB in your environment by using the SQL command:
select SID, Networkdomain, networkalias from userinfo where networkalias = '<UserAlias>'
  1. Open SQL Server Management Studio.
  2. Run the provided query
update USERINFO
set NETWORKDOMAIN = 'contoso.com', NETWORKALIAS = 'axadmin', SID = 'S-1-5-21-2423567575-2897528880-3809357285-500'
where id = 'admin'

where NETWORKDOMAIN is the DomainName of your environment where you have restored the DB and NETWORKALIAS is the username to which you want to provide access(Admin in this case).