在Netsuite中查找角色和脚本部署关系



是否可以轻松查看哪些角色可以访问哪些脚本部署?

我尝试制作脚本部署保存的搜索以及角色保存的搜索,但无法真正找到如何提取这些信息。

有人知道吗?

我看不到通过保存的搜索在UI/中完成这项工作的方法。但是,您可以通过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;       
});

最新更新