如何在Netsuite中获取suitescript 2.0中登录用户的配置文件映像?
我可以通过下面的SuiteScript2.0获取记录的用户详细信息如何在Netsuite中获取suitescript 2.0中登录用户的配置文件映像?,netsuite,suitescript2.0,Netsuite,Suitescript2.0,我可以通过下面的SuiteScript2.0获取记录的用户详细信息 runtime.getCurrentUser(); 答案是 { "id": 12345, "name": "ABC", "email": "abc@gmail.com", "location": 0, "department": 0, "role": 3, "roleId": "administrator", "roleCenter": "BASIC",
runtime.getCurrentUser();
答案是
{
"id": 12345,
"name": "ABC",
"email": "abc@gmail.com",
"location": 0,
"department": 0,
"role": 3,
"roleId": "administrator",
"roleCenter": "BASIC",
"subsidiary": 1,
"timezone": "Asia/Calcutta"
}
没有属性可从getCurrentUser()的响应中获取图像。
要获取Suitescript 2.0中已登录用户的个人资料图片,是否有其他方法?您需要使用记录或搜索模块从员工(用户)记录中获取图像id,并输入用户id:
var userId = runtime.getCurrentUser().id;
var userRecord = record.load({ //make sure 'N/record' is defined as record
type: record.Type.EMPLOYEE,
id: userId
});
var imageId = userRecord.getValue('image');
或:
对于服务器脚本,然后可以使用N/file
模块加载映像文件,并传入imageId
。如果需要在客户端获取图像,可以获取字段的文本而不是值:
var userId = runtime.getCurrentUser().id;
var imageId = search.lookupFields({
type: search.Type.EMPLOYEE,
id: userId,
columns: 'image'
}).image[0].text;
这将返回文件柜中图像的相对路径。您需要使用记录或搜索模块从员工(用户)记录中获取图像id,并传入用户id:
var userId = runtime.getCurrentUser().id;
var userRecord = record.load({ //make sure 'N/record' is defined as record
type: record.Type.EMPLOYEE,
id: userId
});
var imageId = userRecord.getValue('image');
或:
对于服务器脚本,然后可以使用N/file
模块加载映像文件,并传入imageId
。如果需要在客户端获取图像,可以获取字段的文本而不是值:
var userId = runtime.getCurrentUser().id;
var imageId = search.lookupFields({
type: search.Type.EMPLOYEE,
id: userId,
columns: 'image'
}).image[0].text;
这将返回文件柜中图像的相对路径