/**
* An example of nlapiLookupField to retrieve joined fields from a related record
*/
var repId = nlapiGetFieldValue("salesrep");
// Retrieve multiple fields from the associated Sales Rep
var repData = nlapiLookupField("employee", repId, ["email", "firstname", "department.name"]);
console.log(repData);
console.log(repData.firstname + "'s email address is " + repData.email);
console.log(repData.firstname + "'s department is " + repData["department.name"]);