Friday, November 20, 2020

SQL query to get vendor email addresses and phone details in ax/d365 x++

Below is the sql query to get vendor email address. Please change it according to your requirement.



select VENDTABLE.ACCOUNTNUM as VendorId, DIRPARTYTABLE.NAME, LogisticsElectronicAddress.DESCRIPTION as Type,LogisticsElectronicAddress.LOCATOR as Email , LogisticsElectronicAddress.ISPRIMARY, LogisticsLocationRole.TYPE, DIRPARTYLOCATION.PARTY, VENDTABLE.dataareaid from VENDTABLE 

join DIRPARTYLOCATION on VENDTABLE.PARTY = DIRPARTYLOCATION.PARTY

join LogisticsElectronicAddress on DIRPARTYLOCATION.LOCATION = LogisticsElectronicAddress.LOCATION

join LogisticsElectronicAddressRole on LogisticsElectronicAddress .RecId = LogisticsElectronicAddressRole .ElectronicAddress

join LogisticsLocationRole on LogisticsElectronicAddressRole.LocationRole = LogisticsLocationRole .RecId

join DIRPARTYTABLE on VENDTABLE.PARTY = DIRPARTYTABLE.RECID

where LogisticsElectronicAddress.TYPE = 2 // address 1 is phone number

// where LogisticsElectronicAddress.ISPRIMARY = 1 // for primary contacts only // 0 for non primary

order by VENDTABLE.ACCOUNTNUM



1 comment:

  1. I would like to say that this blog really convinced me to do it! Thanks, very good post.
    szybki kredyt online

    ReplyDelete

Power Automate vs Azure Logic Apps vs Azure Data Factory: What They Are, When to Use Them, and How to Integrate Non-Microsoft Systems

  In today’s cloud-first, API-driven enterprise landscape, automation and integration have become vital pillars of operational agility. Micr...