Pages

Showing posts with label DAX. Show all posts
Showing posts with label DAX. Show all posts

Wednesday, February 16, 2011

Fixing addresses that are not formatted correctly

An issue that comes up often at various clients is addresses being formatted incorrectly.  Functional people have been able to fix this by "touching" the zip code on the address with an issue...basically they click on it and re-choose the zip code and save to fix it.

What is going on behind the scenes, is the AddressMap is being used to correctly format the address.

The Address.address, CustTable.address, VendTable.address, etc. fields should not be manually filled in.  They should not have data dumped into them either.  It is a derived/built field that depends on the country code and each individual format.

This is important when you deal with international customers and customs.  Customs for European countries, for example, can be very picky with documents.  If the address is even slightly malformed, I've seen product get held for up to a month, and sometimes it's seized...all for a silly address error.

Here is a job I wrote that can be adapted to automate the process of building addresses using AddressMap.  Right now, it lets you pick a customer that you want to correct the addresses for, then displays a before/after of the addresses.

Enjoy!  As always, comments are welcome!



static void updateCustAddress(Args _args)
{
    Dialog                              dialog;
    DialogField                         field;
    CustTable                           custTable;
    Address                             address;
    DirPartyAddressRelationship         dpar;
    DirPartyAddressRelationshipMapping  dparm;
    AccountNum                          accountNum;
    ;

    dialog  = new Dialog("Build customer address");
    dialog.addText("Select your customer to update:");
    field   = dialog.addField(typeid(CustAccount));
    dialog.run();

    if(dialog.closedOk())
    {
        accountNum = field.value();

        if (CustTable::exist(accountNum))
        {
            ttsbegin;
            while select forupdate address
                join dpar
                join dparm
                join custTable
                where custTable.AccountNum      == accountNum          &&
                      custTable.PartyId         == dpar.PartyId         &&
                      dpar.RecId                == dparm.PartyAddressRelationshipRecId  &&
                      dparm.RefCompanyId        == curExt()               &&
                      dparm.AddressRecId        == address.RecId
            {
                info(strfmt("Type %1 - before:", address.type));
                info(strFmt(">%1<", address.Address));
                
                address.AddressMap::setAddress();
                address.update();
                
                info(strfmt("Type %1 - after:", address.type));
                info(strFmt("<%1>", address.Address));
            }
            ttscommit;
        }
        else
        {
            info("Invalid Account");
        }

    }

    info("Done");
}

Saturday, January 29, 2011

Installing Microsoft Dynamics AX 2009 Refresh 4 on Windows 7/Vista

Microsoft has released yet another wonderful VPC that showcases the entire stack of Microsoft products working with Dynamics AX 2009 (Can be found HERE with PartnerSource/CustomerSource).  Unfortunately...microsoft says:

This virtual machine is configured for Windows 2008 Hyper-V and can’t be used with VPC (or Windows 7 Virtualization)
You can get Refresh 3.5 to work as a VPC...but I'm going to show you a neat way to get Refresh 4 running as a dual bootable Dev environment.

This HowTo assumes you have downloaded Refresh 4 and extracted it and you have AX5-W8R2-01.vhd and AX5-W8R2-01_DB.vhd available.

Start by right clicking on computer and clicking "manage".

Go to Storage>Disk Management, then click the action menu at the top and click "Attach VHD".  Attach both VHDs.  You will need the AX5-W8R2-01_DB.vhd to be the F: drive, or once you mount it, you will need to copy over the files and file structure to the F: drive of your machine.  This is because this SQL instance looks for its database on the F: drive.

After you've added these, all you need to do is create a boot entry to boot the VHD's.  This can be done with the command line tool BCDboot.  If your Windows partition of the VHD is now on the E: drive for example, you just need to type from an elevated command prompt:
>bcdboot E:\windows
This will add a boot entry.  To see your work, just run "msconfig" and click the boot tab.  There you can set the default OS you'd like to boot, the wait time (I changed mine to 5 seconds), etc.

All that's left to do is restart the machine and make sure you select the Server 2008 R2 instance.  Expect the following:

  • First boot will be slow because all of the drivers are trying to sync to your new hardware
    • This means your desktop might not show up for several minutes
  • Page file issues initially (not sure why these occur, but I just ignore)
  • Some drivers you might have to manually download and install specific to your machine.  The only one I had to install was my graphics driver so that it would detect my two monitors.
This is nice because Refresh 4 requires a good amount of horsepower to run (recommended min of 4GB memory, dual CPU), and you can devote your entire machine to it.  Also dual monitors, etc feel nicer when it's not in a VPC window.

Happy DAX'ing!