ax 2012 how to get the warehouse telephone number through code

static Container CustVendorInfo(Common _CustVendTable)
{
    LogisticsElectronicAddress          LogisticsElectronicAddress;
    LogisticsLocation                   LogisticsLocation;
    VendTable VendTable;
    CustTable Custtable;
    str phone,fax,email,url;
    RecId  RecId;    
    ;
   
    switch(_CustVendTable.tableid)
    {
        case tableNum(Custtable) : CustTable = _CustVendTable ; RecId  = CustTable.postalAddress().Location;
            phone = Custtable.phone();
            fax   = DirParty::primaryElectronicAddress(Custtable.Party, LogisticsElectronicAddressMethodType::fax).Locator;
            email = Custtable.email();
            url   = Custtable.url();
            break;  
        case tableNum(Vendtable) : VendTable = _CustVendTable ; RecId  = VendTable.postalAddress().Location;
            phone = Vendtable.phone();
            fax   = DirParty::primaryElectronicAddress(Vendtable.Party, LogisticsElectronicAddressMethodType::fax).Locator;
            email = Vendtable.email();
            url   = Vendtable.url();
            break;  
    }
   
    select firstOnly LogisticsLocation
        where LogisticsLocation.ParentLocation      == RecId
        && LogisticsLocation.IsPostalAddress        == NoYes::No;
    if (LogisticsLocation)
    {
        while Select LogisticsElectronicAddress
            where LogisticsElectronicAddress.Location    == LogisticsLocation.RecId
        {
            switch(LogisticsElectronicAddress.Type)
            {
                case LogisticsElectronicAddressMethodType::Phone:
                    phone = LogisticsElectronicAddress.Locator;        
                    break;
                   
                case LogisticsElectronicAddressMethodType::fax:
                    fax = LogisticsElectronicAddress.Locator;        
                    break;
           
                case LogisticsElectronicAddressMethodType::Email:
                    email = LogisticsElectronicAddress.Locator;        
                    break;
                   
                case LogisticsElectronicAddressMethodType::URL:
                    url = LogisticsElectronicAddress.Locator;        
                    break;
            }
        }
    }
   
   
    return [phone,fax,email,url];
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.