Wednesday, 4 January 2023

Query that returns primary contacts of customer

 

Sometimes we need to get the primary details of a customer. Below SQL query provides the primary email information of the customer. Depending on contact type, we can get the details. If we comment the type condition, query will return all the primary contact information.

1
2
3
4
5
6
7
8
9
10
11
12
select LogisticsElectronicAddress.locator,
LogisticsElectronicAddress.TYPE,
LogisticsElectronicAddress.ISPRIMARY,* from custtable
JOIN DirPartyLocation
ON dirPartyLocation.party = custtable.Party
JOIN LogisticsElectronicAddress
ON LogisticsElectronicAddress.Location =
dirPartyLocation.Location
AND LogisticsElectronicAddress.Type = 2
AND LogisticsElectronicAddress.ISPRIMARY = 1
JOIN LogisticsElectronicAddressRole
ON LogisticsElectronicAddressRole.ElectronicAddress =
LogisticsElectronicAddress.RecId
join LogisticsLocationRole
ON LogisticsLocationRole.RecId =
LogisticsElectronicAddressRole.LocationRole
where custtable.AccountNum = "CustAccount"

No comments:

Post a Comment

Filtering Company-Specific Product Templates - SysRecordTmpTemplate lookup

Hi Techies - Recently I have come across a requirement where I needed to display product templates specific to a selected company for a give...