简体   繁体   English

Suitescript Netsuite创建销售订单

[英]Suitescript Netsuite create salesorder

I am not a suitescript coder. 我不是Suitescript编码员。 I have JS knowledge. 我有JS知识。 A while back i came across a script which would create an SO for me. 前一段时间我遇到了一个脚本,它将为我创建一个SO。 The script was similar to the one attached, just that it had the else condition for when "Typeof Value=='object' 该脚本与附带的脚本相似,只是当“ Typeof Value =='object'

function getItems(datain) {
var err = new Object();

// Validate if mandatory record type is set in the request
if (!datain.recordtype)
{
    err.status = "failed";
    err.message= "missing recordtype";
    return err;
}

var record = nlapiCreateRecord(datain.recordtype);

for (var fieldname in datain)
{
 if (datain.hasOwnProperty(fieldname))
 {
     if (fieldname != 'recordtype' && fieldname != 'id')
     {
         var value = datain[fieldname];
        nlapiLogExecution('DEBUG', fieldname);
         // ignore other type of parameters​
         if (value && typeof value != 'object') 
         {
             record.setFieldValue(fieldname, value);
         }
     }
 }
}
var recordId = nlapiSubmitRecord(record);
nlapiLogExecution('DEBUG','id='+recordId);

// returns the created record in JSON format​
 var nlobj = nlapiLoadRecord(datain.recordtype,recordId);
return nlobj;

} }

Can someone help me fill the else section where I would process the Items array when the recordtype would be 'salesorder' 有人可以帮我填写其他部分,当记录类型为“ salesorder”时我将处理Items数组

Greatly appreciate your help. 非常感谢您的帮助。

Thanks 谢谢

Something like this: 像这样:

nlapiSelectNewLineItem('item');
nlapiSetCurrentLineItemValue('item', 'item', 380, true, true);
nlapiSetCurrentLineItemValue('item', 'location', 102, true, true);
nlapiCommitLineItem('item');

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

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