在 Netsuite 中查找角色和脚本部署关系
Finding role and script deployment relations im Netsuite
是否可以轻松查看哪些角色可以访问哪些脚本部署?
我尝试制作脚本部署保存搜索以及角色保存搜索,但无法真正找出如何提取此信息。
有人知道吗?
我在 UI/via 保存的搜索中找不到完成此操作的方法。您可以通过 suitescript 完成此操作,但要遵循这种布局。您可以定期将脚本安排到 运行,或者只是在浏览器控制台中 运行 来获取您想要的数据。您还可以添加代码来创建一个 excel 文件以轻松消化信息...
SS2.0 中的布局
//gather all applicable role ids
var Roles = [];
//gather all applicable script deployment ids
var ScriptDep = [];
//for each script deployment id get the "Roles" from the "Audience" tab in the UI
for (var i=0; i<ScriptDep.length; i++){
var script = record.load({
type: 'scriptdeployment',
id: ScriptDep[i]
});
var scriptAudienceField = script.getField({
fieldId: 'audslctrole'
});
var scriptAudience = scriptAudienceField.getSelectOptions({
filter : '*',
operator : 'contains'
});
var RoleID = ; //role ID you care about, maybe loop through all roles with Roles[j]
var test = scriptAudience.includes(RoleID); //returns true or false this deployment is deployed to this role
}
Suite Answer 86327给出如下SS1.0示例代码
var search = nlapiLoadSearch('scriptdeployment', 147); //load search of all script deployments
var resultSet = search.runSearch();
resultSet.forEachResult(function(searchResult){ //for each script deployment returned by the search, get the id
var record = nlapiLoadRecord('scriptdeployment', searchResult.id); //load the script deployemnt
var arrayOfRoles = record.getFieldValues('audslctrole'); //get the values of the "Roles" from the "Audience" tab in the UI
if(arrayOfRoles == '18'){ //change based on the internal ID of the role
console.log(searchResult.id);
};
return true;
});
是否可以轻松查看哪些角色可以访问哪些脚本部署?
我尝试制作脚本部署保存搜索以及角色保存搜索,但无法真正找出如何提取此信息。
有人知道吗?
我在 UI/via 保存的搜索中找不到完成此操作的方法。您可以通过 suitescript 完成此操作,但要遵循这种布局。您可以定期将脚本安排到 运行,或者只是在浏览器控制台中 运行 来获取您想要的数据。您还可以添加代码来创建一个 excel 文件以轻松消化信息...
SS2.0 中的布局
//gather all applicable role ids
var Roles = [];
//gather all applicable script deployment ids
var ScriptDep = [];
//for each script deployment id get the "Roles" from the "Audience" tab in the UI
for (var i=0; i<ScriptDep.length; i++){
var script = record.load({
type: 'scriptdeployment',
id: ScriptDep[i]
});
var scriptAudienceField = script.getField({
fieldId: 'audslctrole'
});
var scriptAudience = scriptAudienceField.getSelectOptions({
filter : '*',
operator : 'contains'
});
var RoleID = ; //role ID you care about, maybe loop through all roles with Roles[j]
var test = scriptAudience.includes(RoleID); //returns true or false this deployment is deployed to this role
}
Suite Answer 86327给出如下SS1.0示例代码
var search = nlapiLoadSearch('scriptdeployment', 147); //load search of all script deployments
var resultSet = search.runSearch();
resultSet.forEachResult(function(searchResult){ //for each script deployment returned by the search, get the id
var record = nlapiLoadRecord('scriptdeployment', searchResult.id); //load the script deployemnt
var arrayOfRoles = record.getFieldValues('audslctrole'); //get the values of the "Roles" from the "Audience" tab in the UI
if(arrayOfRoles == '18'){ //change based on the internal ID of the role
console.log(searchResult.id);
};
return true;
});