One of the functions of a custom NetSuite employee portal that I've been working on is the ability by authorized users to see an employee's emergency contacts. If you're not familiar with NetSuite's support for tracking emergency contacts, you can find the functionality by navigating to an employee record, clicking on the Humand Resources tab, and you should see an Emergency Contacts subtab. Here's an example.

Accessing the emergency contacts via SuiteQL is actually quite easy. The data is stored in a table named EmployeeEmergencyContact. Here's a query that returns the emergency contacts for a specified employee ID.

SELECT
	Contact,
	Relationship,
	Address,
	Phone
FROM
	EmployeeEmergencyContact
WHERE
	Employee = 786

You can also use join the EmployeeEmergencyContact and Employee tables to get the data needed to create an "emergency contacts directory." Here's what that query might look like.

SELECT
	Employee.ID AS EmployeeID,
	Employee.FirstName,
	Employee.LastName,
	Employee.Email,
	EmployeeEmergencyContact.Contact,
	EmployeeEmergencyContact.Relationship,
	EmployeeEmergencyContact.Address,
	EmployeeEmergencyContact.Phone
FROM
	Employee
	LEFT OUTER JOIN EmployeeEmergencyContact ON
		( EmployeeEmergencyContact.Employee = Employee.ID )
ORDER BY
	Employee.LastName,
	Employee.FirstName	

Have a question about this post, or about SuiteQL in general? Feel free to contact me.