简体   繁体   English

TypeError log.debug 不是函数

[英]TypeError log.debug is not a fucntion

Script below is throwing up an error "JS_ Exception - TypeError log.debug is not a function"下面的脚本抛出错误“JS_ Exception - TypeError log.debug is not a function”

I basically want to set the price level to 'custom' whenever a user enters a line on a sales order.每当用户在销售订单上输入一行时,我基本上都想将价格水平设置为“自定义”。

Help appreciated.帮助表示赞赏。 Thank you.谢谢你。

/**
 * @NApiVersion 2.1
 * @NScriptType ClientScript
 * @NModuleScope SameAccount
 */

define(['N/search', 'N/log'], (search, log) => {
    function fieldChanged(scriptContext) {
        const sublistVal = scriptContext.sublistId;
        if (sublistVal === 'item') {
            try {
                rec.setCurrentSublistValue({
                    sublistId: sublistVal,
                    fieldId: 'price_value',
                    value: 'custom',
                    ignoreFieldChange: true
                });
            } catch(e) {
                log.debug({
                    title: 'Error',
                    details: 'Unable to set price level'
                });
            }
        }
    }
    return {
        fieldChanged: fieldChanged
    };
}); 

This is a Client Side Script.这是一个客户端脚本。 You must use console.log() and use you browsers console to debug your code您必须使用console.log()并使用浏览器控制台来调试代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM