Saturday 20 April 2013

Restrict duplicate records in AX

In case you have a requirement where you are suppose to restrict the duplicate records.

E.g. :


If in case you have 4 fields.
And you require that any two same record values in the four or less columns should not repeat.

You don't want same record(same combination) to be saved twice.



Column:       A            B          C             D
                 amit      60       India          emp
                  yatish       60       India          emp
                 amit         60       India          emp                ****this record should not be saved


Solution :

1) Make new index to the table.
2) Add the fields that you want to be added to the restricting combination.(Here all 4)
3)Go to properties and set 'AllowDuplicates' to "No".

This will restrict you from saving any duplicate combination in the table.

Note: In case you need only A & B column without repeat then add only A & B fields to index.

Delete all transaction data for a specific company in AX

I have noticed that sometimes we might need to delete all the transaction data for a particular company without altering the configuration data.This is possible in AX.

1)Login into AX in the company for which you want to delete the transaction data.
2)Go to AOT.
3)Open class SysDatabaseTransDelete
4)Run it and Click 'YES' to delete all the transaction data in the current logged in company.

This might take few moments depending on the amount of data.