Thursday, 29 December 2011

Refresh Parent caller


FormDataSource   fds;

fds = element.args().record().dataSource();
 //fds.executeQuery(); // Use this as per requirement
 fds.refresh();
fds.research();

Wednesday, 30 November 2011

Attach files through code Ax 2012


All,

Following code helps you to attach files.

// AOSRunMode::Client
void attachFile()
{
    Filename            fileName  = @'C:\temp\test.csv';
    DocuRef             tdocuRef;
    DocuRef             updDocuRef;
    DocuType            docuType;      
    HcmWorker           hcmWorker = HcmWorker::findByPersonnelNumber('000466');
    DocuActionArchive   docuActionArchive;  
    ;

    select docutype where docutype.ActionClassId == classNum(DocuActionArchive) &&
       DocuType.TypeId == 'file' ;
   
    tdocuRef.RefRecId       = hcmWorker.RecId;
    tdocuRef.RefTableId     = hcmWorker.TableId;
    tdocuref.RefCompanyId   = 'dat';
    tdocuref.TypeId         = docutype.TypeId;  
    tdocuref.insert();
   
    ttsBegin;  
    select forupdate updDocuRef where updDocuRef.RecId ==  tdocuref.RecId;  
   
    docuActionArchive       = DocuAction::newDocuRef(updDocuRef);  
    docuActionArchive.add(updDocuRef, fileName);
    ttsCommit;  
}

Monday, 7 November 2011

Set language used for Report

Use the following code line in your report init() method
element.design().languageID('en-us');

Monday, 31 October 2011

Account number for transaction type "customer balance" does not exist

Define account number for customer group in the posting profile.
You can try the same for the following errors as well.
Account number for transaction type "customer balance" does not exist

Thursday, 29 September 2011

How to add or delete a label file in Dynamics AX 2012


In this post we will look at how label files are contained within models in Dynamics AX 2012.

We now have a new node in AOT - Label Files

All labels in the system are grouped under this node.

Now suppose we have a label from another installation which we want to bring in to our system. Right click on the Label Files node and select Create from File. Browse and selct your .ald file. Once you select the file and hit OK, a new node is added under the Label Files node corresponding to the label file imported. You will get an info message saying "Imported label file:C:\Users\Administrator\Desktop\MyLabelen-us.ald"

In AX 2009, after placing a label file, we needed to restart the AOS so that the label index was build. This isn't required in Dynamics AX 2012. Just try using the label somewhere, and you will see that it is immediately referenced.

If you search in your application folder, you wont find the label file there. The application folder is located here C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\Application\Appl\Standard

In Dynamics AX 2012, the label file is imported in your current model.

Now let us restart the AOS and see what happens. After restarting the AOS, go back to your application folder and try to find the label file again. This time the label file will be found.

Point to remember, on every AOS restart, all label files will be copied to the application folder from the model store. So your label files are contained in your models but they are stored in your application folder as well.

Now let us try to delete the label file. Right click on your label file. Do you see a delete/remove option?

The answer is no. So how do we delete the label file then? The solution which I figured out was,
  1. To create a temporary model
  2. Move our label file to the temporary model
  3. Stop the AOS
  4. Delete the temporary model
  5. Start the AOS
Let us get about with these tasks
  1. Go to Tools -> Model management -> Create model
  2. Enter name as TemporaryModel. Press OK. You will recieve an info message saying "The model TemporaryModel was created successfully in layer var."
  3. Right click on your label file and select "Move to model"
  4. Select the TemporaryModel checkbox and press OK.
  5. Stop the AOS.
  6. Open a command prompt. We will be using the command line utility AXUTIL to delete the model.
  7. Issue the following command in the command prompt
AXUTIL delete /model:TemporaryModel
  1. You will be prompted if you want to delete the model or not. Press Y
  2. Start the AOS
  3. Delete the label file from your application folder as well.
When you open AX now, you will get a dialog saying that "Your model store has been modified." This is normal because each time you perform an operation on a model, you will get this dialog. Depending on your operation, you should select one of the option. Since we just deleted a model which just had a label file, select Skip.
Open AOT and notice that the label file is deleted now.
Check if the references of the label work. I bet they wont be.

In this post we learnt how label files are managed in Dynamics AX 2012, how to import a label file and how to delete them.

Thursday, 1 September 2011

.NET CIL Compilation error/Not Working

All,


All compilation errors need to be resolved before CIL generation will successfully complete.


Wednesday, 31 August 2011

EDT Relation Migration Tool [Dynamics AX 2012]

Hi All,

In AX 2009, We all know that Table relations were defined only through EDTs and this was a problem if multiple relations were needed between tables, or if relations involved composite keys.
In Microsoft Dynamics AX 2012, relations can no longer be created under extended data type (EDT) nodes in the Application Object Tree (AOT). Relations that are defined under EDT nodes are still effective, but in a future release they will be obsolete and deleted.
The EDT relation migration tool helps you move relations from EDT nodes to table nodes. The EDT relation migration tool is found on the client menu, under Tools > Code upgrade > EDT relation migration tool.
For more information : click here.


Deactivating configuration key will not affect the table any more [Dynamica AX 2012]

Hi All,

In DAX 2009 or earlier versions, deactivating a configuration key affected a table in Microsoft Dynamics AX and the associated table was removed from the underlying Microsoft SQL Server database.
In Microsoft Dynamics AX 2012, the associated tables are not removed from the database. Instead, the tables are deactivated in the system, which means that they are treated as empty tables. However, the deactivated tables and their data are still fully available in the underlying database.

Free Text Invoices allows to add Qty and unit price in Dynamics AX 2012

Hi All,
Free Text Invoice in AX 2012 is enhanced to add quantity and unit price. I remember for most of the clients we have added/customized these fields. But, during the upgrade to AX 2012, we probably need to help the clients with the new feature in AX2012 [Ofcourse, bringing data will be tricky]
Path >> AR >> Common >> Free Text Invoices >> All Free Text invoices. Create a header and Journal Line as shown below.
On the Action Pane, click Free text invoice.
- In the Customer account, select customer 1103
- Go to Invoice lines > Description, enter Installation and configuration.
- Select Main Account as 401190.
- Enter Quantity as 3
- Enter Unit Price as 500
Below is the screen shot for reference.

Save the record and click on the post button on the Action pane.
I see an important tab on the Lines called Distrubute amount. This will help to distribute the amount across multiple financial dimensions. [Help from MS docs]. Will post another entry in detail to explain the same.


AX 2012 Upgrade - Detect Code Upgrade Conflicts Issue

Hi All,
We are upgrading from  Ax2009 - Ax2012.When we try to run the upgrade checklist - Detect Code upgrade conflicts process our client is crashed after few minutes of the process start.After a long research we found the following few things which made our process complete successfully.

1. Full AOT compilation is required
2. Run the AX in single-user mode
3. Remove customizations from the following forms.(We used Debugging Tools for windows - Windbg and then keep track on AX client and found the following forms causing crash)
           
BOMTable
HRMAbsenceApproval
InventPosting
LedgerJournalTable
ProjStatistic
ProjTransEmpl
SalesCreateQuotation
SalesEditLines
VendTable
PurchEditLines
                                                                                                                                                                              





Wednesday, 6 July 2011

Friday, 1 July 2011

AxUtil Commands - 2012

AxUtil create /model:"My Model" /Layer:USR
AxUtil export /model:"My Model" /file:MyModel.axmodel
AxUtil import /file:MyModel.axmodel
AxUtil delete /model:"My Model"
AxUtil delete /layer:isv 
Axutil delete /layer:isv /db:<database> /s:<server>