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

By now, you all must be aware that we are done with AOD files in Dynamics AX 2012. Model is the new deployment option for deploying AX objects on various installations. If you want to learn more about models, MFP has an excellent three part series on it which you can read here.

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
  8. AXUTIL delete /model:TemporaryModel
  9. You will be prompted if you want to delete the model or not. Press Y
  10. Start the AOS
  11. 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.

Thats all for today, but do check back soon as we continue learning.

Popular posts from this blog

Get selected records in Dynamics AX 2012

SysQuery::findOrCreateRange() - A better way to create dynamic query ranges

How to refer to form controls in code without setting the AutoDeclaration property in Dynamics AX?