Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 175888

RE: How to Write the code to get the telephone number and fax in the fetch method in ax reprots

$
0
0

you may get this information as under

CompanyInfo CompanyInfo;
    
    CompanyInfo = CompanyInfo::find();
    
    info("Phone: "+CompanyInfo.phone());
    info("Fax: "+CompanyInfo.teleFax());


Above code will  return you Primary Phone and Fax. In case you wan to get the non-primary as well, you may use code as under. In below example I am getting phone number of HCMWorker which is party. in your case it will be a legal entity which you have to consider as party

 LogisticsElectronicAddress  logisticsElectronicAddress;
    HcmWorker                   HcmWorker;
    DirPartyLocation            dirPartyLocation;
    DirPartyTable               DirPartyTable;
    int64                       RecIdOfParty;
    ;

          RecIdOfParty    = HcmWorker::findByPersonnelNumber("000670").DirPerson().RecId;

            select dirPartyTable
                where dirPartyTable.RecId == RecIdOfParty;



            select firstOnly Description,Type,Locator,LocatorExtension,IsPrimary,IsPrivate,RecId from logisticsElectronicAddress
                order by logisticsElectronicAddress.IsPrimary desc
            join dirPartyLocation
                where dirPartyLocation.Party            == dirPartyTable.RecId
                    && dirPartyLocation.IsPostalAddress  == NoYes::No
                    && logisticsElectronicAddress.Location == dirPartyLocation.Location
                    && logisticsElectronicAddress.Type      == LogisticsElectronicAddressMethodType::Phone;
            {
                info(strFmt("%1 : %2 %3",logisticsElectronicAddress.Description,logisticsElectronicAddress.Locator,logisticsElectronicAddress.LocatorExtension));
            }



Viewing all articles
Browse latest Browse all 175888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>