我们如何在UserEvent SuiteScript 2.0

时间:2018-03-15 17:36:38

标签: javascript netsuite suitescript2.0

我们如何在UserEvent SuiteScript 2.0中获取记录类型?

我想将我的SuiteScript部署为超过1种记录类型(客户付款,贷记凭证,存款,发票)

现在在我的SuiteScript中,我需要识别记录类型并根据它执行操作。

我的代码:

define(['N/record', 'N/https'],
function(record,https)
{
    function afterSubmit(context)
    {
        var myUrl = 'My url here';

        var rType = context.newRecord.Type;
        log.debug({title: 'rType1 ', details: rType });
        //This returns nothing

        rType = record.Type;
        log.debug({title: 'rType2 ', details: rType });
        //This gives all the available record types in Netsuite

        var JsonPayload = 'need to know whether its an invoice or a payment here';
        log.debug({title: 'payload ', details: JsonPayload });

        var response = https.post({ url: myUrl, body: JsonPayload});
        log.debug({title: 'response ', details: response });
    }
}
return {
    afterSubmit: afterSubmit
};

});

1 个答案:

答案 0 :(得分:3)

应为ctx.newRecord.type。 javascript区分大小写。