ax 2012 how to get the warehouse telephone number through code ??

ax 2012 how to get the warehouse telephone number through code ??

Just go through the table ‘InventLocationLogisticsLocation’ where you will find the relations on inventlocation and logistic location. inventlocation is your warehouse and the field ‘location’ is the record id which we specify at the address tab in warehouse master form. so just go to ‘LogisticsLocation’ table and find the reference which you can put in ‘LogisticsElectronicAddress’ and you can get the telephone number from that table. (LogisticsElectronicAddress).Locator is the telephone number field.

hi vishal ,

i tried with this code , i am able to get the record up to the logisitic location prefect but after that i am not able to find the record but it not correct one , can u please check my code and tell where i am doing wrong …

static void warehousetelephonenumber(Args _args)

{

LogisticsLocation LogisticsLocation;

LogisticsLocationAccessView LogisticsLocationAccessView;

LogisticsElectronicAddress ElectronicAddress;// location == LogisticsLocation.recid;

inventsite inventsite;

LogisticsLocation logisticlocation;

LogisticsLocationId LogisticsLocationId;

CustTable CustTable;

custInvoiceJour custInvoiceJour;

Inventlocation Inventlocation;

SalesTable salestable;

InventSiteId inventsiteid;

dirpartytable dirpartytable;

RecId InvoicingAddress;

DirPartyTable dirparyttable;

LogisticsPostalAddress LogisticsPostalAddress ;

//InventSite inventsite;

LogisticsEntityPostalAddressView LogisticsEntityPostalAddressView;

select * from custInvoiceJour

where custInvoiceJour.InvoiceId== ‘W10/INV/1314/000013’;

select * from salestable where

salestable.SalesId == custInvoiceJour.SalesId;

// info(strFmt(’%1’, salestable.RecId));

select * from inventsite where

inventsite.SiteId == SalesTable.InventSiteId;

// info(strFmt(’%1’, inventsite.RecId));

InvoicingAddress = InventLocation::find(custInvoiceJour.inventLocationId).RecId;

// info(strFmt(’%1’, InvoicingAddress));

// info(strFmt(’%1’,inventsite.RecId));

while select * from LogisticsLocationAccessView

where LogisticsLocationAccessView.Entity == InvoicingAddress //inventsite.RecId //InvoicingAddress

&& LogisticsLocationAccessView.EntityType == LogisticsLocationEntityType::Warehouse

{

select * from LogisticsLocation

where LogisticsLocation.RecId== LogisticsLocationAccessView.Location;

select * from LogisticsPostalAddress

where LogisticsPostalAddress.RecId == LogisticsLocation.RecId;

info(strFmt(’%1’, LogisticsLocation.RecId));

// info(strFmt(’%1’,LogisticsPostalAddress.State));

select * from ElectronicAddress

where ElectronicAddress.Location== LogisticsLocation.RecId

&& ElectronicAddress.Type == LogisticsElectronicAddressMethodType::Phone

join LogisticsLocation

where LogisticsLocation.RecId == LogisticsLocationAccessView.Location;

//OR

/* select * from ElectronicAddress

where ElectronicAddress.Location== LogisticsLocationAccessView.Location

&& ElectronicAddress.Type == LogisticsElectronicAddressMethodType::Phone;*/

//OR

/* LogisticsLocation = LogisticsLocation::find(LogisticsLocationAccessView.Location);

select * from ElectronicAddress

where ElectronicAddress.Location== LogisticsLocation.RecId

&& ElectronicAddress.Type == LogisticsElectronicAddressMethodType::Phone;*/

info(strFmt(’%1 - %2’,LogisticsLocation.RecId, ElectronicAddress.Locator ));

}

}

thanks in advance …

Try out this :

static void warehousetelephonenumber(Args _args)

{

str Warehouse;

LogisticsElectronicAddress LogisticsElectronicAddress;

LogisticsLocation LogisticsLocation;

InventLocationLogisticsLocation InventLocationLogisticsLocation;

InventLocation InventLocation;

;

Warehouse = “HydBad”;

InventLocation = InventLocation::find(Warehouse);

Select firstOnly InventLocationLogisticsLocation

where InventLocationLogisticsLocation.InventLocation == InventLocation.RecId;

if (InventLocationLogisticsLocation)

{

select firstOnly LogisticsLocation

where LogisticsLocation.ParentLocation == InventLocationLogisticsLocation.Location

&& LogisticsLocation.IsPostalAddress == NoYes::No;

if (LogisticsLocation)

{

Select firstOnly LogisticsElectronicAddress

where LogisticsElectronicAddress.Location == LogisticsLocation.RecId;

if (LogisticsElectronicAddress)

{

info(strFmt("%1", LogisticsElectronicAddress.Locator));

}

}

}

}