如何使用内部ID搜索员工的姓名?我已尝试在对象上使用getText函数来获取销售代表名称而不是内部ID,但SS2.0不允许这样做。我也尝试过使用search.fieldLookUp函数,但这也为我带来了错误。
/**
* @NApiVersion 2.0
* @NScriptType UserEventScript
*/
define(['N/search'],
function(search) {
return {
afterSubmit : function(context){
//log.debug('hello world');
var customer = context.newRecord;
var custId = customer.getValue('entityid');
var custEmail = customer.getValue('email');
var salesRep = customer.getValue('salesrep');
答案 0 :(得分:3)
您可以使用搜索查找来检索员工的姓名:
var employeeNameFieldLookUp = search.lookupFields({
type: search.Type.EMPLOYEE,
id: employeeInternalId ,
columns: ["firstname", "middlename", "lastname"]
});
var firstname = employeeNameFieldLookUp.firstname;
var middlename = employeeNameFieldLookUp.middlename;
var lastname = employeeNameFieldLookUp.lastname;
var employeeName = [firstname, middlename, lastname].join(" ");