Announcements
No record found.
Hello,
how to import Fixed assets locations with addresses through DIEF?
Regards,
David
*This post is locked for comments
try to use asset entity ,check this blog for more details
community.dynamics.com/.../import-assets-using-data-import-framework-ax-2012-r3
Hi Mahmoud,
the Asset entity did not have address of location.
we can use the link you mentioned to import assets with locations.
what i need in addition is to import address of FA location.
Try to publish address via excel add-in
atinkerersnotebook.com/.../using-the-dynamics-ax-excel-add-in
it didn't work with Excel Add-in. I coudn't add a new address.
what i need, FA locations can be added easily through DIEF.
I need a way to import address for every FA location.
Hi David,
Which entity are you using to import it?
Thanks,
Sangram
Hi Sangram,
I used FA asset location entity, it has location, location id and name fields.
I can't see this entity in my box, you have to write a new method to add address code along with locations in your entity class.
Meanwhile you can use below code to import your data, this code will import locations with it's address, you can add additional address fields as required. You have to use a CSV file with header to import this. please prepare your CSV file as per the sequence in below code, or change the code as per your file sequence. Please see if this helps.
static void SSFALocationAddressImport(Args _args) { Dialog dialog; DialogField dfFileName; int noOfRecs = 0; CommaIO csvFile; container fileInCon,checkcon; counter icount,inserted,updated; FileName fileName; AssetLocation assetLocation; AssetLocationId assetLocationId; AssetLocationName assetLocationName; LogisticsPostalAddress postalAddress; LogisticsLocation location; LogisticsAddressCity city; LogisticsAddressCountyId county; LogisticsAddressZipCodeId zipcode; LogisticsAddressStateId state; LogisticsAddressCountryRegionId country; LogisticsAddressStreet streetname; LogisticsAddressCountryRegion logisticsAddressCountryRegion; LogisticsAddressState logisticsAddressState; LogisticsAddressZipCode logisticsAddressZipCode; LogisticsAddressCounty logisticsAddressCounty; LogisticsAddresssCity logisticsAddresssCity; Description addressName; ; inserted = 0; dialog = new Dialog("Pick the file"); dfFileName = dialog.addField(extendedTypeStr(FileNameOpen)); dialog.filenameLookupFilter(["CSV ","*.csv"]); if (dialog.run()) { filename = dfFileName.value(); } csvFile = new CommaIO(filename, 'r'); if (csvFile) { while (csvFile.status() == IO_Status::OK) { try { fileInCon = csvFile.read(); icount++; if (fileInCon && icount>1) { assetLocationId = conPeek(fileInCon,1); assetLocationName = conPeek(fileInCon,2); addressName = conPeek(fileInCon,3); city = conPeek(fileInCon,4); state = conPeek(fileInCon,5); country = conPeek(fileInCon,6); zipcode = conPeek(fileInCon,7); streetname = conPeek(fileInCon,8); if (state) { logisticsAddressState=LogisticsAddressState::find(country,state); if(!logisticsAddressState) { info(strFmt("State %1 is not present",state)); continue; } } if (city) { logisticsAddresssCity=LogisticsAddresssCity::findCityState(city,state); if(!logisticsAddresssCity) { info(strFmt("City %1 is not present",city)); continue; } } if (zipcode) { logisticsAddressZipCode=LogisticsAddressZipCode::findZipCodeCity(zipcode,city); if(logisticsAddressZipCode) { info(strFmt("ZipCode %1 is not present",zipcode)); continue; } } location.clear(); location.Description = addressName; location.insert(); postalAddress.Location = location.RecId; postalAddress.CountryRegionId = country; postalAddress.Street = streetname; postalAddress.City = city; postalAddress.State = state; postalAddress.ZipCode = zipcode; postalAddress.LogisticsPostalAddressMap::formatAddress(); postalAddress.insert(); assetLocation = AssetLocation::find(assetLocationId,true); if (assetLocation) { ttsbegin; assetLocation.LogisticsLocation = location.RecId; assetLocation.Location = assetLocationId; assetLocation.Name = assetLocationName; assetLocation.update(); updated++; ttsCommit; } else { assetLocation.clear(); assetLocation.LogisticsLocation = location.RecId; assetLocation.Location = assetLocationId; assetLocation.Name = assetLocationName; assetLocation.insert(); inserted++; } } }//try catch { info(strFmt("Error at line %1",icount)); } }//while }//if csv info(strfmt("%1 records inserted, %2 records updated",inserted,updated)); }//final
Please replace below line in code.
if(logisticsAddressZipCode) to if(!logisticsAddressZipCode)
FYI D365 allows you to upload FA location and address through the Excel integration in a much quicker and simpler way
Hi Zvika,
thank you for your reply,
is this true for AX 2012 R3 as well?
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Joris dG 5
Andrew Jones a1x 2
GL-01081504-0 1