Transaction BODY Field from COLUMN Field (Netsuite)

2.8k views Asked by At

I have an issue where some of our orders are being imported directly into Netsuite, and there is information from the first line item, that I need to copy into the transaction record (i.e. custom field on sales order)

I want to set this up so that it is automatic, I don't have access to the system that is used to bring the orders into Netsuite, and I only JUST got suitescript access and everything I read about that is way above my head.. I know basic HTML and some of the scripting formulas from Netsuite and that's all.

I was hoping there would be a CUSTOM FIELD FORMULA or some other similar way that I can just easily source the information directly from the first item in the item sublist?

1

There are 1 answers

1
michoel On BEST ANSWER

This would be quite trivial to implement using SuiteScript. The example below assumes you want to copy the Memo field (description) from the first line item to the body Memo field. The basic idea would be something like the below (untested code):

function userEventBeforeSubmit(type){
    if (type === 'create') {
        var record = nlapiGetNewRecord();
        var memo = record.getLineItemValue('item', 'memo', 1);
        record.setFieldValue('memo', memo);
    }
}

If want to accomplish this via custom fields etc. it is possible using "Custom Fields with Values Derived from Summary Search Results".

To do this create a Saved Search as follows:

  • Type: Transaction
  • Criteria: [none]
  • Results: Formula (Text), Summary Type = Maximum, Formula: DECODE({line}, 1, {memo}, NULL)
  • Available Filters: Internal ID

Then create a Custom Transaction Body Field as follows:

  • Type: Free Form Text
  • Store Value: F
  • Validation & Filtering > Search: [Saved Search from previous step]

As this is a dynamically calculated field (Store Value = F), it would be available when viewing the record, but not in Saved Searches and lists. To remove this limitation, you can create a Workflow that would copy this field to another one that is stored.