创建计划脚本,要从项目子列表上的标准记录中获取值,我该怎么做?
function execute(scriptContext) {
var poid = runtime.getCurrentScript().getParameter("custscriptbb1_mga_po_id");
var objRecord = record.load({
type: record.Type.PURCHASE_ORDER,
id: poid,
isDynamic: false,
});
var itemvalue = objRecord.getValue({
fieldId: 'item'
});
var rate = objRecord.getValue({
fieldId: 'item'
});
log.debug("itemvalue: "+ itemvalue + "rate "+rate);
要从子列表中读取数据,您需要使用record.getSublistValue或record.getCurrentSublistValue,其中参数应如下所示。
{
sublistId: 'item',
fieldId: 'item',
line: LINE_NO
}
注意: getCurrentSublistValue只能在动态模式下使用,必须先使用selectLine方法选择该行。