下面的代码是将记录保存到 Netsuite,我想要 select 行项目。我不想保存记录

Below code is saving records to Netsuite, I want to select line items. I don't want to save records

以下代码用于向 select 行项目进行存款。它将记录保存到 Net suite.But 我只想 select 行项目但那没有发生。

function OnPageInit() 
    { 

      var search = nlapiSearchRecord(null, 'customsearch322'); 
      nlapiLogExecution('DEBUG', 'creating a `enter code here`deposit');
      var d = nlapiCreateRecord('depo' + 'sit');  

        d.setFieldValue('department', 13);
      d.setFieldValue('trandate', nlapiDateToString(new Date()));   
      d.setFieldValue('memo', 'created in code');

      d.selectNewLineItem('other');
      d.setCurrentLineItemValue('other','entity', 41877);
    d.setCurrentLineItemValue('other','department', 13);
    d.setCurrentLineItemValue('other','account', 135);
    d.setCurrentLineItemValue('other','amount',23);
    d.setCurrentLineItemValue('other','memo','Tgh');
    d.commitLineItem('other');
    // iF uncomment tbelow line it save records to Netsuite
      //var id = nlapiSubmitRecord(d, true);


    } 

下面是正确的代码

nlapiSelectLineItem("other", 1);
        nlapiSetCurrentLineItemValue('other','entity', 41877);
        nlapiSetCurrentLineItemValue('other','department', 13);
        nlapiSetCurrentLineItemValue('other','account', 135);
        nlapiSetCurrentLineItemValue('other','amount', 23);
        nlapiSetCurrentLineItemValue('other','memo','Tgh');
        nlapiCommitLineItem("other");

这是工作代码......

function clickMe() 
    { 

               var transid = nlapiGetFieldValue('custbody2');    
              var filters = [
                new nlobjSearchFilter('transactionnumber', null, 'is', transid), 
            ];
              var search = nlapiSearchRecord(null, 'customsearch322',filters); 
             var k=1;
            for(i=0;i<search.length;i++)
            {
                    var CheckaccountId=search[i]["valuesByKey"]["account"]["value"];
                    var ccode=search[i]["valuesByKey"]["customer_custentity_mb_ccode"]["value"];
                    var department=search[i]["valuesByKey"]["department"]["value"];
                    if(CheckaccountId =="1" || CheckaccountId=="7")
                    {           
                        var setaccount= getaccountforitem(CheckaccountId,ccode,department);                 
                        nlapiSelectLineItem("other", k);
                        k++;
                        var client =search[i]["valuesByKey"]["customer_internalid"]["value"];
                        nlapiSetCurrentLineItemValue('other','entity',client);
                        nlapiSetCurrentLineItemValue('other','department',search[i]["valuesByKey"]["department"]["value"]);
                        nlapiSetCurrentLineItemValue('other','account', setaccount);
                        nlapiSetCurrentLineItemValue('other','amount', search[i]["valuesByKey"]["amount"]["value"]);
                        //nlapiSetCurrentLineItemValue('other','class', search[i]["valuesByKey"]["classnohierarchy"]["value"]);
                        nlapiSetCurrentLineItemValue('other','memo',search[i]["valuesByKey"]["memo"]["value"]);
                        nlapiCommitLineItem("other");
                    }               
            }

    }