To get Customer,Vendor VAT Registration Number by code in Axapta in 2012 version you can try below code in data method on table label then you can use the method in string control on form .   This code will work perfectly .    display name Get_TaxRegistration()    {      TransDate _transDate = systemDateGet();      DirPartyLocation            dirPartyLocation;      TaxRegistration             taxRegistration;      TaxRegistrationTypeApplicabilityRule  taxRegistrationTypeApplicabilityRule;      if (_transDate)      {        dirPartyLocation = DirPartyLocation::findByPartyLocation(          this.Party,          this.invoiceAddress().Location);        if (dirPartyLocation)        {          select firstonly validTimeState(_transDate) taxRegistration            where taxRegistration.DirPartyLocation == dirPartyLocation.RecId            join RecId from taxRegistrationTypeApplicabilityRule              order by taxRegistrationTypeApplicabilityRule.IsPrimaryAddressRestricted desc           ...
Technical Tutorials x++,tips on issues or troubleshooting On Ax ERP ,Microsoft Dynamics 365,Ax 2012,Microsoft , U.S.,Business Software solution.