var conatctname = "";
var conatctId = null;
conatctId = voucherRecord.getFieldValue("custrecord_treating_dentist");
conatctname = nlapiLookupField("contact", conatctId, "entityid");
detail = detail.replace("[TREATINGDENTISTNAME]", conatctname); //2.0.3
nlapiLookupField(type, id, fields, text)
type{string} [required] – The record internal ID name. In the NetSuite Help Center,. Record IDs are listed in the “Record Internal ID” column.id{int} [required] – The internalId for the record, for example 777 or 87.fields{string | string[]} [required] – Sets an array of column/field names to look up, or a single column/field name. Thefieldsparameter can also be set to reference joined fields (see the third code sample).text{boolean} [optional] – If not set, this argument defaults to false and the internal ID of the dropdown field is returned. If set totrue, this argument returns the UI display name for this field or fields (valid only for SELECT|IMAGE|DOCUMENT fields).