web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

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

(0) ShareShare
ReportReport
Posted on by 1,737

i want to display the telephone number and fax in the report, take the details from the logistics electronic address table.

i am writing the below code and test with debuugger but i am unable to get the data.

select Name from dirPartyTable where dirPartyTable.Name == 'CPIL'
    && dirPartyTable.PrimaryContactPhone == logisticsElectronicAddress.RecId;
    if(logisticsElectronicAddress.Type == LogisticsElectronicAddressMethodType::Phone)
    {
    Telephone       = logisticsElectronicAddress.Locator;
    }
    else
    {
    Fax             = logisticsElectronicAddress.Locator;
    }

can any one know about this please help me.

*This post is locked for comments

I have the same question (0)
  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    telephone number and fax  of whom ??

    customer, vendor, employee, any other entity??? would you mind to specify???

  • srinivas pamidi Profile Picture
    1,737 on at

    i want to display the legal entity details

  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    is that ax 2012 or ax 2009?

  • Martin Dráb Profile Picture
    237,926 Most Valuable Professional on at

    You get data from LogisticsElectronicAddress, therefore what you should have show and debug is your query for LogisticsElectronicAddress. The query above (for DirPartyTable) isn't important.

  • srinivas pamidi Profile Picture
    1,737 on at

    ax 2012 r3

  • Suggested answer
    Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    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));
                }
    


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.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans