Articles in this section

Configure and map NetSuite subrecords

Subrecords hold information about a parent record and are meaningful only within that context. The subrecord must be created, edited, removed, or viewed from its standard NetSuite record. You may need an overview of working with JSON in integrator.io to configure and map these subrecords. 

Note: Unconfigured subrecord mappings can cause your NetSuite import to fail. Only include subrecord mappings on imports that require subrecord data included in the import. If you experience errors on NetSuite imports that do not require subrecord mapping, verify that unused subrecord field mappings have been removed.  

In some cases, NetSuite requires you to enter subrecords to successfully save the record, such as the Inventory Detail section for a serialized inventory Item on an Item Fulfillment record. In this example, the Item is the parent record, which defines a type of item; its subrecord would be an Inventory Detail.

Supported subrecords

integrator.io offers built-in support for the most common subrecords:

  • Address subrecords
    • An address subrecord for transactions
  • Inventory Detail subrecords, which can belong to...
    • An inventory adjustment 
    • A purchase order
    • Other Inventory Detail-supported records, such as serialized, bin, and lot line items

Address subrecords

When importing into NetSuite, Address subrecords require field mapping as follows:

  1. Add a new entry under Import field (NetSuite).
  2. Accept the suggestion for this field: Use Address subrecord.
  3. Set the Field mapping type to Hard-coded.
  4. Select True for the Value

Then, any address mappings defined will automatically use the Address subrecord if this mapping is set as described. Otherwise, address mappings would automatically use standard address fields.

Inventory Detail subrecords

Inventory Details can be used as either body- or line-level subrecords. A line-level subrecord is one that occurs at a sublist level. 

Example A: Line-level subrecord integration

Let’s look at how Inventory Detail subrecords might be imported in a typical flow, Sales Order with an Inventory adjustment, below. 

Sample export data

In the JSON structure of the example exported records, notice the line items, Inventory Serial Item1 and Inventory Serial Item2, with a quantity of 2 and 1 respectively. These are NetSuite serialized items, as is apparent from the associated serial numbers. 

[
  {
    "customer_name": "Test Customer",
    "email": "celigo@test.com",
    "line_items": [
      {
        "item_name": "Inventory Serial Item1",
        "item_amount": "245",
        "item_qty": "2",
        "item_location": "1",
        "inv_detail": [
          {
            "serialnumber": "inv01",
            "qty": 1
          },
          {
            "serialnumber": "inv02",
            "qty": 1
          }
        ]
      },
      {
        "item_name": "Inventory Serial Item2",
        "item_amount": "542",
        "item_qty": "1",
        "item_location": "1",
        "inv_detail": [
          {
            "serialnumber": "inv03",
            "qty": 1
          }
        ]
      }
    ]
  }
]

Create a Sales Order import

  1. In an existing flow, click Add destination/lookup in Flow Builder.
  2. Select NetSuite for the Application.
  3. For What would you like to do? pick Import records into destination application.
  4. Choose a Connection from the list or click + to create one. 
  5. Do not check the Use existing import box, since we’re building a new import of a special type. 
  6. Click Next.
Create destination_lookup.png

The Create import pane then offers you additional settings for the new import. When you select Sales Order for the Record type, you’re provided with an option for handling subrecords:

When you click + Add subrecord, the Add subrecord import pane slides into view.  Choose the subrecord Items: Inventory Details.

In Path to node that contains items data enter the JSON path to the line-item fields, in this example: line_items. Then, click Save.

Add subrecord import closes. Finally, save and close the new import. 

Map fields for import

Return to Flow Builder and click the Import mapping ) button on the import just created. 

Typically, you would be taken directly to edit mappings. With subrecords present, you are first offered the choice of mappings for either the primary record or the subrecord:

  • NetSuite Sales Order import – The parent record mappings
  • NetSuite Sales Order import – Items : Inventory Details (Subrecord) – The inventory detail subrecord mapping

Starting with the parent-level records, enter the source fields according to the JSON structure and select the corresponding NetSuite subrecords:

Save and close the parent mapping. Then, return to edit the mapping for NetSuite Sales Order import – Items : Inventory Details (Subrecord). For each of the sublist lines, map the Inventory Detail records:

Save and close this Edit mapping pane, as well, to complete the import mapping.

Example B: Body-level subrecord integration

Body-level subrecords are found in a few NetSuite types, such as assemblybuild, which has both a body-level Inventory Detail and a line-level inventory detail. 

Sample export data

In essence, as shown in the JSON structure, this record has a parent-level subrecord as well a child-level Inventory Detail subrecord.

[
   {
    "customer_name": "Test Customer",
    "email": "celigo@test.com",
    "parent_item": "Iphone 12",
    "parent_item_serialno": [
      {
          "quantity": 1,
          "serialno": "SAFAVACA1214"
      }
  ],
    "line_items": [
      {
        "item_name": "Inventory Serial Item1",
        "item_amount": "245",
        "item_qty": "2",
        "item_location": "1",
        "inv_detail": [
          {
            "serialnumber": "inv01",
            "qty": 1
          },
          {
            "serialnumber": "inv02",
            "qty": 1
          }
        ]
      },
      {
        "item_name": "Inventory Serial Item2",
        "item_amount": "542",
        "item_qty": "1",
        "item_location": "1",
        "inv_detail": [
          {
            "serialnumber": "inv03",
            "qty": 1
          }
        ]
      }
    ]
  }
]

Create a WO Build import

Add a NetSuite subrecord import, similar to the import created above, in this example for a WO Build record. When adding subrecords, you will then have a choice for the line-level and body-level records:

Proceed to provide the path for the line-level subrecord Components : Inventory Details, with the same process demonstrated above for the Sales Order import

Repeat to add a subrecord import for the body-level subrecord Inventory Detail.

Map fields for import

Continuing this example for the body-level subrecord Inventory Detail, open the import mapping in Flow Builder. Here, the serialno and quantity are relative to the path to items node that we selected earlier.

Was this article helpful?
2 out of 3 found this helpful

Comments

7 comments
Date Votes
  • Quite helpful article for new partners, as mapping Inventory Details subrecord can be tricky if you haven't done it before. Thanks Stephen Brandt for putting this together.

    0
  • Is there any way to import a transaction, specifically an invoice, where you have serialized and non-serialized items where some require inventory detail and others do not. This is a questions specific to a NetSuite import. 

     

    0
  • Hey Ian Luck

    The above article should work for every transactions' inventory detail sub record. Integrator IO would automatically ignore the inventory subrecord for a line if it doesn't have matching inventory detail data from the source. The setup should be the same for all of the transaction types.

    Ideally, our users populate inventory detail in the source only for the item line(s) that require an inventory sub record(serialized, bin, lot lines).

    0
  • I have the same issue as Ian. I'm getting errors (ticket # 106465) when I attempt to import a transaction with two items where one is lot enabled and the other is not. If I edit the retry data and include either one of the items it will post correctly. It fails when both items are included in the payload.

     

    1
  • Suppose I have selected 'line_items' as a path for inventory details.
    Is this possible to use the parent level field for inventory details sub-record mapping? 

    0
  • Hi A Arora

    It is not possible to use the parent level field for inventory details sub-record mapping. However, you can configure a preMap hook to copy the required parent level fields to line_items.

    Example:

    Lets say our source data is like this (where quantity is a parent field):

        {
        "customername": "Sky Games",
          "salesorderid": "34988",
          "quantity": "15",
        "line_items": [
            {
              "itemname": "Arctic Monkeys Coffee Mug",
              "itemid": "6941",
              "upcode": "4721",
              "subsidiary": "Honeycomb Holdings Inc.",
              "location": "Hyderabad",
              "inv_detail": [
                {
                  "binnumber": "69"
                }
              ]
            }
          ]
        }

    We can configure a preMap hook with the following script to copy the parent field to all line_items:


    function preMap (options) {
      return options.data.map((d) => {
      d.line_items.forEach((item) => {
        item.quantity = d.quantity
        })
        return {
          data: d
        }
      })
    }

    So, before the mapping happens, our source data is modified by the hook to this:

      {
        "data": {
          "customername": "Sky games",
          "customerid": "7013",
          "PO #": "4431",
          "salesorderid": "34988",
          "quantity": "15",
        "line_items": [
            {
              "itemname": "Arctic Monkeys Coffee Mug",
              "itemid": "6941",
              "upcode": "4721",
              "subsidiary": "Honeycomb Holdings Inc.",
              "location": "Hyderabad",
              "inv_detail": [
                {
                  "binnumber": "69"
                }
              ],
            "quantity": "15"
            }
          ]
        }
      }

    Now, in the sub-record mappings you should be able to see 'quantity' in the dropdown list.

    0
  • Very helpful article, thank you!

    For a work order completion record, should the inventory detail body-level subrecord be available through Integrator? I am not seeing it, but seems like it should be.

    0

Please sign in to leave a comment.