Restore Class files

I accidentially modified CLASS : AddressZipCodeImport_US and AddressZipCodeImportDialog in Axapata 4.0. The environment is not letting me undo or restore original file. I need to get the original layouts of these classes. either by importing XPO of the files or some other function

I am yet not familiar with Dynamics AX 4.0, but I am hoping it didn’t change that much.

What layer did you modify the classes on?

Did you try selecting the layer option from the context menu on each of the classes and then removing the modified layer? (for example, if you made modifications on the USR layer, than removing the user layer will restore the class to it’s state before the modifications)

Good luck

Hi,

By default if an object exists in several layers, then the layers command would be enabled in the shortcut menu on the particular object. In your case AddressZipCodeImport and AddressZipCodeImportDialog classes.

If you want to undo the changes that you made -

  • please log into Axapta in the layer that you originally made the change
  • Right click on the object and select layers and
  • Select delete

On a side note - have a look at the Application object layer field available under Tools → Options → Development tab → General field group.

Hope this helps,

Thanks Harish! I figured it out. Brain shorted out …! Too many training classes!

I have another question related to ZipCode Import functions.

I have written a custom script to import the Zips.

There are Zipcodes that relate to more than one city, but I can not enter more than one city or alias for the zip code

Example: Zip = 44060

there are 6 records for this zip in the DB we received from the vendor.

Primary city is Mentor

aliases: MOL, Mentor on the Lake, Concord TWP, Kirtland Hills, Mentor on the…

should they be entered as separate cities or as aliases or did I miss something in the script?

Hi
I would create them as Zip code records with the same ZipCodeId (although I do not know what you mean with “aliases”)

Zip/Postal Code 44060 encompases the cities of Mentor, Mentor on the Lake, Concord, Kirtland Hills.

The DB of zip codes from the USPS has the following:

ZipCode City CityAliasName CountyName State PrimaryRecord
44060 MENTOR MOL LAKE OH
44060 MENTOR CONCORD TWP LAKE OH
44060 MENTOR KIRTLAND HILLS LAKE OH
44060 MENTOR MENTOR LAKE OH P
44060 MENTOR MENTOR ON THE LAKE LAKE OH
44060 MENTOR MENTOR ON THE LAKE OH

the primary city is MENTOR.

In Axapta’s zipcode import script, there will only be one entry for 44060 then repeatedly update the cityAlias field . There needs to be a City - Zip relationship that allows dropdown selection of City Aliases.

Well, the ZipCodeIdx in the ZipCode table does AllowDuplicates, so I don’t see what the problem is:

You just have to add 6 lines with the same ZipCodeId, that’s it.

If you have errors during the process or if only one record is stored in the DB after your script is finished, probably the error is somewhere in it.

For example, if you do a “check if record already exists” validation before inserting a record in your script. (using the exist() or the find() method on the ZipCode table, for example)