【问题标题】:Netsuite Formula FieldNetsuite 公式字段
【发布时间】:2013-02-13 15:50:49
【问题描述】:

目前,我想在 Netsuite 中创建公式字段,用于评估订单项的结果。 例如:在采购订单中,正文字段中所有行项目数量的总和。

我不太确定如何做到这一点。 你怎么看?

【问题讨论】:

    标签: search field formula netsuite


    【解决方案1】:

    我认为您应该创建一个将在自定义字段中维护此计数的 userevent 脚本。那么这个字段可以在任何地方访问。

    【讨论】:

      【解决方案2】:

      试试这个解决方案:

      1. 在采购订单中创建自定义正文字段。内部 ID 示例:“custbody_sample_field_po”。
      2. 在 After Submit 中创建一个用户事件脚本,部署在采购订单中。

      这是脚本:

      var recordId = nlapiGetRecordId();
      var obj = nlapiLoadRecord('purchaseorder', recordId);
      
      //Get all line item quantity and sum it
      var sum = parseInt(0);
      var count = obj.getLineItemCount('item');
      for(var i = 1; i <= count; i++)
      {
          var temp = parseInt(obj.getLineItemValue('item', 'quantity', i));
          sum += temp;
      }
      
      //Save the total to the custom field
      obj.setFieldValue('custbody_sample_field_po', sum);
      nlapiSubmitRecord(obj, true);
      

      【讨论】:

        【解决方案3】:

        您可以创建交易主体字段“custbody_sum_quantity”

        function updateTotal(type)
        {
          if(type == 'create' || type == 'edit')
           {
              var id= nlapiGetRecordId();
              var type = nlapiGetRecordType();
              var record = nlapiLoadRecord(type,id);
              var count = record.getLineItemCount('item');
              var total = 0;
              if(count  > 0)
              {
               for(var i = 1; i<=count;i++)
                {
                   var quantity= record.getLineItemValue('item', 'quantity', i);
                   total += quantity;
                 }
              }
              record.setFieldValue('custbody_sum_quantity',total );
              var recid = nlapiSubmitRecord(record,true,true);
           }
        }
        

        【讨论】:

        • 请不要使用向您自己的网站发送垃圾邮件的答案;我们是来帮忙的,而不是做广告的。
        猜你喜欢
        • 1970-01-01
        • 2017-04-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-10-19
        • 2015-11-14
        相关资源
        最近更新 更多