首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何从Netsuite中的工单创建调拨订单?

如何从Netsuite中的工单创建调拨订单?
EN

Stack Overflow用户
提问于 2019-06-05 06:52:52
回答 1查看 213关注 0票数 0

我是一个脚本新手,我想知道我的代码是否正确,以便在Netsuite中输入WO时创建一个to:

代码语言:javascript
复制
define(['N/record',], function (record) {  function afterSubmit(context) {
if(context.type == 'delete'){
    log.debug('Exiting script', '...');
    return;
}
try{
var so = record.load({
    type:'workorder',
    id:context.newRecord.id
});
var so_items = so.getLineCount({sublistId:'item'});


// Create new Transfer Order if Record is On Create.
 var to_record = record.create({
    type:'transferorder',
    isDynamic:true
});

to_record.setValue({fieldId:'customform', value:136});
to_record.setValue({fieldId:'class', value:so.getValue('class')});
to_record.setValue({fieldId:'transferlocation', value:so.getValue('location')});

setLineItemsOnTO(so_items, to_record, so);

to_record.setValue({fieldId:'custbody_related_record', value:context.newRecord.id});
so.setValue({fieldId:'custbody_related_record', value:to_record.save()});
so.setValue({fieldId:'orderstatus',value:'B'});
so.save({ignoreMandatoryFields:true});
} catch(e){
    log.debug('Error Loading Record' + context.newRecord.id, e);
    return;     }
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56452308

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档