选择合同字段后,日记帐分录自动填充行字段

时间:2019-07-03 17:05:21

标签: suitescript2.0

用户选择合同字段后自动填充日记帐分录行字段

在日记帐输入行中,我们希望在用户选择/编辑日记帐输入行上的合同字段后自动填充“省份”,“服务类型”,“市场部门”和“部门”字段(如在合同窗口中设置)。

我正在使用客户端脚本2.0自动填充字段。它什么也没做。该脚本随附供您参考。请告知我所缺少的东西吗?

/**
 * @NApiVersion 2.x
 * @NScriptType ClientScript
 * @NModuleScope SameAccount
 */
define(
    ['N/currentRecord',
     'N/search',
     'N/ui/dialog'
     ],

function(currentRecord, search, dialog) {

/**
 * This function loops through each line and updates its class value
 * if necessary.
 * 
 * @param {N/currentRecord.CurrentRecord} rec - The record being edited
 */
function updateAllLinesWithClass(rec) {

    /* {number} The number of item lines on the current record */
    var lineCount = rec.getLineCount({sublistId: 'Lines'});

    /* For each line */
    for (var i = 0; i < lineCount; i++) {

        /* Select the line */
        rec.selectLine({sublistId: 'Lines', line: i});

        /* Update its class field value */
        postSourcing(scriptContext);

        /* Commit the line */
        rec.commitLine({sublistId: 'Lines'});
    }
}



function postSourcing(scriptContext) {

    /* {N/currentRecord.CurrentRecord} */
    var rec = scriptContext.currentRecord;

  var lineClass = rec.getCurrentSublistValue({
            sublistId: 'Lines',
            fieldId: 'custcol_cseg_cont'
        });

    if (lineClass == customrecord_cseg_cont.name) {

        /* Set the line default value */
        rec.setCurrentSublistValue({
            sublistId: 'Lines',
            fieldId: 'custcol_cseg_mar_sec',
            value: custrecord152
        });
    }

}


return { 
    postSourcing: postSourcing
 };

});

结果:什么都不做?

0 个答案:

没有答案