netsuite - NetSuite 客户端脚本 2.0 禁用库存明细记录中的到期日期子列表字段
问题描述
我正在尝试禁用库存详细信息中到期日期字段的显示类型。当前客户端脚本仅适用于第一行或 0 索引。我正在尝试在添加库存详细信息时完全禁用所有行的此字段。
这是我的脚本,请告诉我我在这里错过了什么。
谢谢
function lineInit(scriptContext) {
try {
var currentRecord = scriptContext.currentRecord;
var sublistId = scriptContext.sublistId;
if (sublistId !== 'item') return;
var selectedLine = currentRecord.getCurrentSublistIndex({
sublistId: 'item'
});
log.debug({ title: 'selectedLine', details: JSON.stringify(selectedLine) });
var inventoryDetail = currentRecord.getCurrentSublistSubrecord({
sublistId: "item",
fieldId: "inventorydetail"
});
var expiryDate = inventoryDetail.getCurrentSublistField({
sublistId: "inventoryassignment",
fieldId: "expirationdate"
});
expiryDate.isDisabled = true;
} catch (error) {
log.debug({ title: 'Catch Error', details: error });
}
}
解决方案
你需要遍历循环使用
var numLines = objRecord.getLineCount({ sublistId: 'item' });
对于库存详细信息子列表(摘要),就像我们对项目子列表所做的那样,只有它将所有到期日期设置为禁用,您刚刚获取索引“selectedLine”并打印在日志中
推荐阅读
- excel - 修复 MS Excel 中针对目标移动的公式
- wpf - 使用 MVVM 模型层中的 WPF 文本框内容
- java - 如何在 Java 中为 Android 项目制作 Text Bold 的特定部分?
- .htaccess - 重写的 URL 以一种奇怪的方式工作
- swift - Alamofire + Gloss:嵌套 JSON 数组不起作用
- python-3.x - Plotly:使用 pandas 数据框中的行名创建表
- node.js - NodeJS 与 MongoDB 的连接(在 AWS C9 上)返回未定义的 db 对象
- r - 仅保留数据框中的小数
- ios - UIImage Masking with another UIImage
- python - Python:使用循环将行添加到现有数据框中