Hi all, I'm struggling on get only the default Bil...
# suiteql
d
Hi all, I'm struggling on get only the default Billing address from an Employee record. Any hints?
c
Have you tried something like
Copy code
SELECT {fields}
FROM entityaddressbook
WHERE
  entity = {employeeInternalId} AND
  defaultbilling = 'T'
From what I can tell, the
entity
table is a superset of customers, contacts, vendors, employees, and partners (maybe including other names and competitors?) with a single pool of internalids
🙌 1
d
I ended up doing this
Copy code
SELECT 
	employeeaddressbookentityaddress.addr1 AS strStreet,
	employeeaddressbookentityaddress.country AS strCountryCode,
	employeeaddressbookentityaddress.state AS strState,
	employeeaddressbookentityaddress.city AS strCity,
	employeeaddressbookentityaddress.zip AS strPostCode
FROM
	Employee
	LEFT OUTER JOIN employeeaddressbook on (employee.id = employeeAddressbook.entity) AND (employeeaddressbook.defaultbilling = 'T')
	LEFT OUTER JOIN employeeaddressbookentityaddress ON (employeeAddressbook.addressbookaddress = employeeAddressbookEntityAddress.nkey)