Showing posts with label CustTable relation DirAddress. Show all posts
Showing posts with label CustTable relation DirAddress. Show all posts

Sunday, 30 August 2020

CustTable and DirAddressBookParty relation in D365 and Sql

 CustTable and DirAddressBookParty  relation in D365 and Sql

DirAddressBookParty       dirAddressBookParty;

        DirAddressBook                   dirAddressBook;

        CustTable                              custTable;

   select RecId,Party from custTable

            where custTable.AccountNum==this.CustomerAccount;


     select RecId from dirAddressBook 

            where dirAddressBook.Name==this.CountryCode;


             select RecId from dirAddressBookParty

                    where  dirAddressBookParty.Party==custTable.Party && dirAddressBookParty.AddressBook==dirAddressBook.RecId;

SQL query

select DISTINCT DirPartyLocation.PARTY,DirAddressBook.RECID,5637144576 from LogisticsPostalAddress
join DirPartyLocation on DirPartyLocation.LOCATION=LogisticsPostalAddress.LOCATION
Join LOGISTICSLOCATION on LOGISTICSLOCATION.RECID=LogisticsPostalAddress.LOCATION
join DirAddressBook on DirAddressBook.NAME=LogisticsPostalAddress.COUNTRYREGIONID
where DirPartyLocation.ISPRIMARY=1 and party in (select party from CUSTTABLE)
and LOGISTICSLOCATION.ISPOSTALADDRESS=1 and DirPartyLocation.ISPOSTALADDRESS=1 and DirPartyLocation.POSTALADDRESSROLES='Business'
and not exists (select 1 from DirAddressBookParty where DirAddressBookParty.PARTY=DirPartyLocation.PARTY and DirAddressBookParty.ADDRESSBOOK=DirAddressBook.RECID)
 and LogisticsPostalAddress.VALIDTO >=GETDate()

Blog Post 6: Bonus – Building Your First Custom Copilot Plugin in X++

Blog Post 6: Bonus – Building Your First Custom Copilot Plugin in X++  Introduction In our previous posts, we explored what Copilot can do o...