AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 31.05.2019, 10:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
d365technext: Customer Address book relation for channel Database D365FO
Источник: http://d365technext.blogspot.com/201...ation-for.html
==============



Customer Address book relation for channel Database D365FO




Scenario:

Most of our D365FO Fellow are working with Retail where we sync customer with our channel database, and sometime we need to update the customer from POS as well, Sometime channel DB throw exception when while updating the customer information if AddressBook of the customer customer is not properly set.

Its happens when we create customer using AX client or import them via DMF and didn't set the address book value.


So no need to worry using below code & query you can update the customers address book in bulk.

Image:


Code:

publicvoid AddrssBookRelation()
{
DirAddressBookParty dirAddressBookParty;
DirAddressBook dirAddressBook;
CustTable custTable;




select RecId,Party from custTable
where custTable.AccountNum==this.CustomerAccount;


if(custTable)
{
select RecId from dirAddressBook
where dirAddressBook.Name==this.CountryCode;


if(dirAddressBook)
{
select RecId from dirAddressBookParty
wheredirAddressBookParty.Party==custTable.Party && dirAddressBookParty.AddressBook==dirAddressBook.RecId;


if(dirAddressBookParty.RecId==0)
{
dirAddressBookParty.clear();
dirAddressBookParty.Party=custTable.Party;
dirAddressBookParty.AddressBook=dirAddressBook.RecId;
dirAddressBookParty.insert();
}


}
}

}



SQL Query:

INSERT INTO DirAddressBookParty (PARTY,ADDRESSBOOK,PARTITION)
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()

Источник: http://d365technext.blogspot.com/201...ation-for.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
d365technext: D365FO Database Synchronization Blog bot DAX Blogs 0 10.08.2018 19:11
axinthefield: Setting up database log for global address book Blog bot DAX Blogs 0 29.04.2016 21:11
emeadaxsupport: AX 2012 for Retail - Assigning customer address books to retail stores Blog bot DAX Blogs 0 26.04.2013 00:13
Sample Design Patterns: Upgrade to Microsoft Dynamics AX 2009 and issues with the global address book Blog bot DAX Blogs 0 21.12.2010 11:11
wiki.dynamicsbook: Changes Made in Navision Attain 3.60 Blog bot Dynamics CRM: Blogs 0 02.09.2008 13:23
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра
Комбинированный вид Комбинированный вид

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 14:11.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.